• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 00:23
CET 06:23
KST 14:23
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Behind the Blue - Team Liquid History Book15Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8herO wins SC2 All-Star Invitational14
Community News
ACS replaced by "ASL Season Open" - Starts 21/0218LiuLi Cup: 2025 Grand Finals (Feb 10-16)23Weekly Cups (Feb 2-8): Classic, Solar, MaxPax win2Nexon's StarCraft game could be FPS, led by UMS maker10PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar)13
StarCraft 2
General
How do you think the 5.0.15 balance patch (Oct 2025) for StarCraft II has affected the game? Nexon's StarCraft game could be FPS, led by UMS maker Terran Scanner Sweep Behind the Blue - Team Liquid History Book Weekly Cups (Jan 12-18): herO, MaxPax, Solar win
Tourneys
LiuLi Cup: 2025 Grand Finals (Feb 10-16) PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar) RSL Revival: Season 4 Korea Qualifier (Feb 14) Sparkling Tuna Cup - Weekly Open Tournament RSL Season 4 announced for March-April
Strategy
Custom Maps
Map Editor closed ? [A] Starcraft Sound Mod
External Content
The PondCast: SC2 News & Results Mutation # 512 Overclocked Mutation # 511 Temple of Rebirth Mutation # 510 Safety Violation
Brood War
General
[ASL21] Potential Map Candidates Gypsy to Korea Which units you wish saw more use in the game? ACS replaced by "ASL Season Open" - Starts 21/02 Liquipedia.net NEEDS editors for Brood War
Tourneys
Escore Tournament StarCraft Season 1 [Megathread] Daily Proleagues Small VOD Thread 2.0 KCM Race Survival 2026 Season 1
Strategy
Fighting Spirit mining rates Zealot bombing is no longer popular? Simple Questions, Simple Answers Current Meta
Other Games
General Games
Path of Exile Diablo 2 thread Nintendo Switch Thread Battle Aces/David Kim RTS Megathread ZeroSpace Megathread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Ask and answer stupid questions here! European Politico-economics QA Mega-thread The Games Industry And ATVI Russo-Ukrainian War Thread
Fan Clubs
The IdrA Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
TL Community
The Automated Ban List
Blogs
ADHD And Gaming Addiction…
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1539 users

The Big Programming Thread - Page 27

Forum Index > General Forum
Post a Reply
Prev 1 25 26 27 28 29 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Fyodor
Profile Blog Joined September 2010
Canada971 Posts
Last Edited: 2010-12-09 15:36:20
December 09 2010 15:36 GMT
#521
On December 09 2010 21:39 gravity wrote:
Show nested quote +
On December 09 2010 19:07 Fyodor wrote:
wow, the name is not Transaction, I got that confused, thanks.

edit, wait, that's not even my actual code, nevermind.
Here's an actual problem:

+ Show Spoiler +

public class MyEBServer {

public static Transaction[] registeredSales;
public static int numRegisteredSales = 0;
public static Transaction[] registeredBids;
public static int numRegisteredBids = 0;
public static Transaction[] purchases;
public static int numPurchases = 0;

public static void initialize(int size)
{
registeredSales = new Transaction[size];
registeredBids = new Transaction[size];
purchases = new Transaction[size];
}

public static void addItemToSell(User seller, Item item, double askingPrice)
{

if(numRegisteredSales <= size - 1)
{
registeredSales[numRegisteredSales] = Transaction(seller, item, askingPrice, Transaction.SELL);

numRegisteredSales++;
}
else
{
System.out.println("The catalogue of registered items to sell is full.");
}
}



I get a compiler error "cannot find symbol" when I call Transaction, supposed to be a constructor method. I said I don't know how to check an object array but I don't know how to populate it either I guess.

this is what the Transaction method looks like:

+ Show Spoiler +


public class Transaction {

public static int SELL = 0;
public static int BID = 1;
public static int FINAL_SALE = 2;
private static int nextConfirmation = 100;
private int confirmationNumber;
private int type;
private boolean active = true;
private double price;
private Item item;
private User user;

public Transaction(User user, Item item, double price, int type)
{
this.user = user;
this.item = item;
this.price = price;
this.type = type;
this.confirmationNumber = nextConfirmation;

Transaction.nextConfirmation++;

}


Make sure you are importing the Transaction class in the class where you are using it, and do "new Transaction(...)" instead of just "Transaction(...)".

Also, this code has a few issues at first glance:
1. You should use an enum for flags, not static ints.
2. Don't make everything static unless you have a good reason.
3. You should probably use Lists of Transactions instead of fixed-size arrays.
4. Even if you do use arrays, you don't need to count the size separately. Use eg registeredSales.length instead.


using "new" at that spot made it compile, thanks.

I hear you on your list of issues but I have to do it this way. There's a good reason for them to be that way. (except number 1 maybe because I don't know what that means.)
llllllllllllllllllllllllllllllllllllllllllll
dapierow
Profile Blog Joined April 2010
Serbia1316 Posts
December 09 2010 15:55 GMT
#522
Ive got my class for creating a connect four game in java, I need some help making the GUI method

the code I have so far is

String readIn = JOptionPane.showInputDialog ("Welcome to Connect Four \n" +
"Please enter your choice \n" +
" N - New Game \n" +
" Q - Quit the Game \n" );

it opens a menu asking for a new game

next the game board should be displayed each turn, and the name of the current player should
ask them to make their next move.

anyone know how i would write that code?
Eat.Sleep.Starcraft 2
dimfish
Profile Blog Joined February 2010
United States663 Posts
December 10 2010 17:38 GMT
#523
I haven't been in this thread in a while, glad to see its 27 pages long!

TL, what Windows source code editors do you use?

Personally I dislike bulky environments and for a long, long time I've been using TextPad. I like lean and mean. I hear a little about NotePad++ and I like the idea of having cold folding. Anyone feel strongly about either of these?

On Linux I'm an emacs man, if that helps, because vi-style is TOO lean for me!
catamorphist
Profile Joined May 2010
United States297 Posts
Last Edited: 2010-12-10 17:45:52
December 10 2010 17:45 GMT
#524
I use emacs for most stuff (even on Windows) but I use Visual Studio for C#. VS is a good environment for reading code and great at running/testing/debugging, even though it isn't as good at editing text as emacs is.
http://us.battle.net/sc2/en/profile/281144/1/catamorphist/
tofucake
Profile Blog Joined October 2009
Hyrule19192 Posts
December 10 2010 17:48 GMT
#525
I dislike Notepad++. It doesn't behave properly. I like Notepad2, with the code folding mod. On Linux I run gedit, because it's very simple and meets my needs.
Liquipediaasante sana squash banana
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
December 10 2010 17:49 GMT
#526
Notepad++ for light-weight java apps. Netbeans for apps that require GUI.

Eclipse for Android programming.

I wish I could install Visual Studio for C++/OpenGL programming but the motherfucker refuses to be installed, no matter what.
"When the geyser died, a probe came out" - SirJolt
fanta[Rn]
Profile Blog Joined October 2004
Japan2465 Posts
December 10 2010 18:25 GMT
#527
Netbeans is amazing, I made the switch from Eclipse and don't regret it one bit.
That being said, VS is my favourite IDE.
KaiserJohan
Profile Joined May 2010
Sweden1808 Posts
December 10 2010 18:54 GMT
#528
I love Visual Studio. Luckily as students we get free microsoft software so I don't have to pay ir anything(windows 7 professional, visual studio ultimate, etc.. who said microsoft was greedy? You dont see apple giving away all their software free)
ANYWAY! For Java I've only used eclipse and its OK I guess, I just don't like Java very much, I prefer either C/C++ or C#. But I used TextPad -- http://www.textpad.com/ -- alot in C and Java before, I really like it because its so slick, slim and fast.
England will fight to the last American
crappen
Profile Joined April 2010
Norway1546 Posts
December 10 2010 19:46 GMT
#529
On December 11 2010 03:25 fanta[Rn] wrote:
Netbeans is amazing, I made the switch from Eclipse and don't regret it one bit.
That being said, VS is my favourite IDE.


I also made the switch from Eclipse to NetBeans, and it was worth it. Visual Studio however is a complete nightmare to use, been coding C++ for some time in it, and I hate it for all its worth. I only hear its good at debugging, but it stops there. I should have taken the time to use the language in another editor, but I had alot going on when I started the course.



Im a java man, and went from eclipse -> netbeans -> IntelliJ. Took some time to setup my IntelliJ environment (JavaEE), but figured it out and I must say, IntelliJ is such an awesome editor.
IntelliJ is however expensive shit, and it takes quite some time to figure it out how to deploy enterprise components with it, cause I didnt really find much via google, that is the downside with it.

Not sure why anyone would use Notepad++ for anything relating coding when there are Eclipse and NetBeans waiting to be installed.
MasterOfChaos
Profile Blog Joined April 2007
Germany2896 Posts
December 10 2010 19:56 GMT
#530
VS is a lot better for C# development than for C/C++ development.

I recently started working on a c project and was really surprised how much worse VS is for it than for C#. The only cool thing was that edit&continue and the immediate window work for C/C++ code too. What IDE do you recommend for C/C++ code?
LiquipediaOne eye to kill. Two eyes to live.
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
December 10 2010 20:21 GMT
#531
On December 11 2010 04:56 MasterOfChaos wrote:
VS is a lot better for C# development than for C/C++ development.

I recently started working on a c project and was really surprised how much worse VS is for it than for C#. The only cool thing was that edit&continue and the immediate window work for C/C++ code too. What IDE do you recommend for C/C++ code?


Professionally or for study reasons?

If its just for study, there is DevCpp (almost non existant debugging). Back when I was starting in C in 2007 I used to program on it. It was ok, buf you will have to debug using printf() unless you manage to somehow make the bugged debugger work.

Also there is CodeBlocks. I'vent actually used it, but my brother did and said it was a good IDE for C++ (better than DevCpp).
"When the geyser died, a probe came out" - SirJolt
fanta[Rn]
Profile Blog Joined October 2004
Japan2465 Posts
December 10 2010 20:24 GMT
#532
We wrote our game in VS 2008 in C++, worked like a charm.
Kambing
Profile Joined May 2010
United States1176 Posts
Last Edited: 2010-12-10 20:37:12
December 10 2010 20:30 GMT
#533
On December 11 2010 04:56 MasterOfChaos wrote:
VS is a lot better for C# development than for C/C++ development.

I recently started working on a c project and was really surprised how much worse VS is for it than for C#. The only cool thing was that edit&continue and the immediate window work for C/C++ code too. What IDE do you recommend for C/C++ code?


I have my biases, but VS is probably the best large-scale IDE for C/C++ out there today. Earlier releases suffered from issues with large (read: multi-million lines of codes) codebases but that has been cleaned up as of 2010. Also intellisense is far more accurate then previous iterations of VS and now also highlights compiler errors in the IDE like C#.

Alternatives include Dev-C++, QT creator, Eclipse CDT, XCode, and Source Insight. Keep in mind though that complexities in C and C++ (namely macros, templates, and the pre-processor) make it so that C#-like Intellisense and code navigation is intractable. Each of these IDEs have to go through complex hoops to approximate that sort of behavior and none provide the "complete" experience that you are accustomed to in C#.

(Also two things:

1) Visual Studio has support for emacs keybindings. Because of the UI overhaul in 2010, alternative keybindings didn't make it into VS 2010 RTM but were recently added back as a 2010 extension.

2) For those that are unaware, VS 2010 is also available in a free, express edition for individual languages. The C++ version does not include the MFC libraries and some advanced features like code analysis but is otherwise complete.)
crazeman
Profile Blog Joined July 2010
664 Posts
Last Edited: 2010-12-10 21:41:19
December 10 2010 21:34 GMT
#534
I guess this is more like a general question on how to structure/design code.

I graduated from college and received my bachelor's degree in CS last fall but one thing that always bothers me is how shitty my code is. By the time my senior year hit, I was taking 5 CS classes a semester in order to graduate on time and was basically bombarded by constant homeworks/projects. This forced me to write very shitty non-versatile code because I was just rushed to meet the deadline as opposed to writing organized code (I would put everything in one class, use global variables everywhere, etc). Usually I could meet my deadline... but if there was a follow up assignment to modify my old code, I was fucked and might as well rewrite everything since it was a mess to modify it and even I have a hell of a time reading my own code. I got away with this because my professors are lazy as fuck and would usually just run the program and base the grade off of whether it did what it was supposed to.

does anyone have any tip on organizing code or have a good book that they recommend that will help me in this area? A friend of mine told me that I should of taken the Design Patterns course at college but I didn't do it because it wasn't a requirement and it was a class for grad students.


Ive got my class for creating a connect four game in java, I need some help making the GUI method

the code I have so far is

String readIn = JOptionPane.showInputDialog ("Welcome to Connect Four \n" +
"Please enter your choice \n" +
" N - New Game \n" +
" Q - Quit the Game \n" );

it opens a menu asking for a new game

next the game board should be displayed each turn, and the name of the current player should
ask them to make their next move.

anyone know how i would write that code?


Honestly you should do more work on it before asking for help or at least be more specific in what you need help in. Basically you wrote one line of code and you're asking TLers to do the rest. Maybe thats not your intention but thats what it looks like when you put 0 effort into it.
Kambing
Profile Joined May 2010
United States1176 Posts
December 10 2010 22:05 GMT
#535
On December 11 2010 06:34 crazeman wrote:
I guess this is more like a general question on how to structure/design code.

I graduated from college and received my bachelor's degree in CS last fall but one thing that always bothers me is how shitty my code is. By the time my senior year hit, I was taking 5 CS classes a semester in order to graduate on time and was basically bombarded by constant homeworks/projects. This forced me to write very shitty non-versatile code because I was just rushed to meet the deadline as opposed to writing organized code (I would put everything in one class, use global variables everywhere, etc). Usually I could meet my deadline... but if there was a follow up assignment to modify my old code, I was fucked and might as well rewrite everything since it was a mess to modify it and even I have a hell of a time reading my own code. I got away with this because my professors are lazy as fuck and would usually just run the program and base the grade off of whether it did what it was supposed to.

does anyone have any tip on organizing code or have a good book that they recommend that will help me in this area? A friend of mine told me that I should of taken the Design Patterns course at college but I didn't do it because it wasn't a requirement and it was a class for grad students.


I wouldn't feel so bad. Most programmers, let alone fresh college grads, don't know how to write good code. These are the kinds of skills you learn by banging on lots of code for a long period time rather than in the classroom (i.e., the "engineering" in software engineering).

That being said, the best way to gain these sorts of skills is to immerse yourself in coding just to get that experience. For example, try fixing some bugs in an open source project like firefox. This will expose you to code (for which you can judge to be good or bad), how to work with code that you didn't write, and what common practices developer teams employ to sanitize their work.

In terms of books, software engineering literature tends to fall into two categories: 1) software architecture principles: how to structure a software artifact and 2) software engineering process: how to go about the business of building a software artifact. For your purposes, you should try to find books that fall into the first category although the second is important as well (although you need a healthy dose of reality in order to properly digest them).

Two good resources I own and have recommended to others are:

Code Complete by McConnell: big handbook of software engineering best practices.

The Pragmatic Programmer: from Journeyman to Master by Hunt and Thomas: smaller, "tip-like" book of software engineering best practices.

These are a good starting point, but keep in mind you won't get better at coding unless you do lots of it and are critical of your own work (having a mentor that can be critical alongside you also does wonders).
MasterOfChaos
Profile Blog Joined April 2007
Germany2896 Posts
Last Edited: 2010-12-10 22:15:50
December 10 2010 22:12 GMT
#536
Guess I'll upgrade to VS2010 then(Free due to MSDNAA). About Dev-C++ I mainly heard bad stuff, like it's using an outdated compiler and generally being worse than VS.
And I'm aware of all the ugliness in C/C++ which makes writing an IDE much harder than writing a C# IDE. I was still disappointed about how intellisense didn't work in many trivial situations, and I didn't even use anything evil.

@crazeman
Studying design patters is definitely useful. But don't overrate them. Use them as sources of inspiration and not something that needs to be slavishly followed.
In go we have the saying "Study joseki and become two stones weaker". It's the same with design-patters. You really need to understand the how, when and why of them to use them well.

Reading code written by really good programmers is a good idea. Usually (not for C++) the base library of your platform is very high quality and easy to read. I learned a lot from studying the Delphi libraries.

For building code "Code Complete 2" is quite comprehensive, but might I found most of its content rather obvious. And it doesn't cover architecting code.

How about having some project for yourself? That way you can work on it without deadlines, refactor as needed and gain experience. Writing little games is always fun.
LiquipediaOne eye to kill. Two eyes to live.
ParasitJonte
Profile Joined September 2004
Sweden1768 Posts
December 10 2010 22:53 GMT
#537
Dev-C++ is pure shit.

You could try KDevelop perhaps....

I agree that it's quite daunting how much worse VS is for C++ than it is for C#.
Hello=)
kerr0r
Profile Joined September 2008
Norway319 Posts
December 10 2010 23:38 GMT
#538
After reading a bit in this thread I figured I'd give Visual Studio a try, so I downloaded it through MSDNAA. This is a bit off topic but... Why the pictures during the installation? You know, the ones with people dressed in business casual outfits, with unfocused backgrounds and all that? Oh, and of course it's one white guy, one "ethnic" guy and one woman.

Anyone care to explain?
fanta[Rn]
Profile Blog Joined October 2004
Japan2465 Posts
December 10 2010 23:55 GMT
#539
on a side note: MSDNAA rocks :D
flopflop
Profile Joined October 2010
45 Posts
December 11 2010 08:59 GMT
#540
This thread was brought to my attention so I will post my problem here as well. ...somehow Ive gotten myself very far behind in my basic C++ class and I only have a few days to turn in all the programs + quizzes + exercises that I need to turn in. At the moment I'm about to fall asleep, but this is going to be a weekend project for me, probably the only thing I do all weekend. I have 3 programs left to write, like 8 quizzes, a handful of exercises, and honestly I'm only comfortable with the material up until about midterm.. this is all done online by the way.

ANYWAYS

I need help. If anyone would be willing to answer questions and help point me in the right direction when making these programs (someone with an instant messenger) tonight and tomorrow, it would be greatly appreciated. I'd even be willing to ship someone $30 if they are willing to put in some good long hours of C++ tutoring in the next couple days with me.

Someone please help me save my GPA, I am so stressed
Prev 1 25 26 27 28 29 1032 Next
Please log in or register to reply.
Live Events Refresh
RSL Revival
03:00
S4 Americas Server Qualifier
CranKy Ducklings168
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft473
PiGStarcraft400
SortOf 104
StarCraft: Brood War
sorry 136
Leta 121
yabsab 92
Dota 2
monkeys_forever327
LuMiX1
League of Legends
JimRising 684
Super Smash Bros
C9.Mang0746
Mew2King192
Other Games
tarik_tv10626
summit1g9908
ToD66
ViBE61
ZombieGrub42
Organizations
Other Games
gamesdonequick990
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• Hupsaiya 97
• practicex 28
• iHatsuTV 4
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
StarCraft: Brood War
• Diggity5
• iopq 3
• sM.Zik 2
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Scarra2208
• Lourlo1028
• Stunt451
Upcoming Events
RSL Revival
2h 37m
LiuLi Cup
5h 37m
Cure vs Reynor
Clem vs Maru
Rogue vs TriGGeR
ByuN vs Serral
uThermal 2v2 Circuit
6h 37m
PSISTORM Gaming Misc
11h 32m
RSL Revival
12h 37m
AI Arena Tournament
14h 37m
Replay Cast
18h 37m
Sparkling Tuna Cup
1d 4h
LiuLi Cup
1d 5h
Ladder Legends
1d 12h
[ Show More ]
Replay Cast
1d 18h
Replay Cast
2 days
LiuLi Cup
2 days
Wardi Open
2 days
Monday Night Weeklies
2 days
OSC
2 days
WardiTV Winter Champion…
3 days
Replay Cast
4 days
WardiTV Winter Champion…
4 days
Replay Cast
4 days
PiG Sty Festival
5 days
The PondCast
5 days
KCM Race Survival
5 days
WardiTV Winter Champion…
5 days
Replay Cast
5 days
PiG Sty Festival
6 days
Epic.LAN
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Escore Tournament S1: W8
Rongyi Cup S3
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
LiuLi Cup: 2025 Grand Finals
Nations Cup 2026
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025

Upcoming

[S:21] ASL SEASON OPEN 1st Round
[S:21] ASL SEASON OPEN 1st Round Qualifier
[S:21] ASL SEASON OPEN 2nd Round
[S:21] ASL SEASON OPEN 2nd Round Qualifier
Acropolis #4
IPSL Spring 2026
HSC XXIX
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
RSL Revival: Season 4
WardiTV Winter 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
FISSURE Playground #3
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Disclosure: This page contains affiliate marketing links that support TLnet.

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.