• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 22:12
CET 04:12
KST 12:12
  • 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
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)11Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns6[BSL21] Non-Korean Championship - Starts Jan 103SC2 All-Star Invitational: Jan 17-1822Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises3
StarCraft 2
General
Spontaneous hotkey change zerg Chinese SC2 server to reopen; live all-star event in Hangzhou Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns SC2 All-Star Invitational: Jan 17-18 Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises
Tourneys
$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) WardiTV Winter Cup WardiTV Mondays SC2 AI Tournament 2026 OSC Season 13 World Championship
Strategy
Simple Questions Simple Answers
Custom Maps
Map Editor closed ?
External Content
Mutation # 508 Violent Night Mutation # 507 Well Trained Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes
Brood War
General
I would like to say something about StarCraft Potential ASL qualifier breakthroughs? BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion StarCraft & BroodWar Campaign Speedrun Quest
Tourneys
[Megathread] Daily Proleagues [BSL21] Grand Finals - Sunday 21:00 CET [BSL21] Non-Korean Championship - Starts Jan 10 SLON Grand Finals – Season 2
Strategy
Game Theory for Starcraft Simple Questions, Simple Answers Current Meta [G] How to get started on ladder as a new Z player
Other Games
General Games
Awesome Games Done Quick 2026! Mechabellum Beyond All Reason Stormgate/Frost Giant Megathread General RTS Discussion Thread
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Trading/Investing Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced
Blogs
My 2025 Magic: The Gathering…
DARKING
Physical Exercise (HIIT) Bef…
TrAiDoS
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
James Bond movies ranking - pa…
Topin
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2004 users

The Big Programming Thread - Page 679

Forum Index > General Forum
Post a Reply
Prev 1 677 678 679 680 681 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.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 18 2015 19:14 GMT
#13561
Si, senor. That's surprising. I was under the impression the large majority of SEs used C or C++.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Itsmedudeman
Profile Blog Joined March 2011
United States19229 Posts
Last Edited: 2015-11-18 19:50:01
November 18 2015 19:48 GMT
#13562
Well, the reason schools like teaching C is because it teaches you a lot about memory management the hard way, and it's also really good at teaching you about data structures. My school used C as well.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
November 18 2015 22:31 GMT
#13563
On November 19 2015 04:14 WarSame wrote:
Si, senor. That's surprising. I was under the impression the large majority of SEs used C or C++.

I suggest you look through a bunch of job offers of employers in your region and/or employers you'd like to work for and find out what languages they are hiring for. Job offers in the future (when you actually apply for one) might not ask for the same languages anymore, but there will always be an old code base that at least needs to be maintained.
If you have a good reason to disagree with the above, please tell me. Thank you.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 18 2015 22:51 GMT
#13564
In my area it's all Java/C#/Web Suite. Those are more of software development jobs vs. actual SE though.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Cyx.
Profile Joined November 2010
Canada806 Posts
November 19 2015 02:49 GMT
#13565
On November 18 2015 17:30 Manit0u wrote:
Nice. Just out of curiosity, was my answer to him any good? I'd like for someone obviously more knowledgeable in C than me to give a comment on this little monster I've created. I really need to work my C-foo back up a bit

http://www.teamliquid.net/forum/general/134491-the-big-programming-thread?page=677#13538

Well, I'll bite :D the only thing that's a little tricky in this is the Counters_{create,destroy} functions, and in my opinion using those at all here is a major no-no. You don't need to allocate the struct Counters on the heap, you're destroying it right away anyways - let the compiler do the work for you, put it on the stack. Then pass &counters to all Counters_test_* functions instead of counters.

Also, your naming is pretty damn weird in my experience C programmers tend to pick either PascalCase or snake_case (pretty infrequently camelCase) but either way, pick one and stick with it lol
Itsmedudeman
Profile Blog Joined March 2011
United States19229 Posts
Last Edited: 2015-11-19 08:06:57
November 19 2015 08:04 GMT
#13566
On November 19 2015 11:49 Cyx. wrote:
Show nested quote +
On November 18 2015 17:30 Manit0u wrote:
Nice. Just out of curiosity, was my answer to him any good? I'd like for someone obviously more knowledgeable in C than me to give a comment on this little monster I've created. I really need to work my C-foo back up a bit

http://www.teamliquid.net/forum/general/134491-the-big-programming-thread?page=677#13538

Well, I'll bite :D the only thing that's a little tricky in this is the Counters_{create,destroy} functions, and in my opinion using those at all here is a major no-no. You don't need to allocate the struct Counters on the heap, you're destroying it right away anyways - let the compiler do the work for you, put it on the stack. Then pass &counters to all Counters_test_* functions instead of counters.

Also, your naming is pretty damn weird in my experience C programmers tend to pick either PascalCase or snake_case (pretty infrequently camelCase) but either way, pick one and stick with it lol

The function names would throw me off a bit if I was reading that. The function is called test but it also increments a pointer value rather than returning anything. Also yeah, I'm working in C but I like the advice given. The only thing I'd change is wrapping the second code in an inc_time() function.
Manit0u
Profile Blog Joined August 2004
Poland17588 Posts
November 19 2015 10:53 GMT
#13567
Heh, it's been a while since I did anything in C. I guess I'm too sullied by OOP now
Time is precious. Waste it wisely.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
November 19 2015 13:00 GMT
#13568
On November 19 2015 07:31 spinesheath wrote:
Show nested quote +
On November 19 2015 04:14 WarSame wrote:
Si, senor. That's surprising. I was under the impression the large majority of SEs used C or C++.

I suggest you look through a bunch of job offers of employers in your region and/or employers you'd like to work for and find out what languages they are hiring for. Job offers in the future (when you actually apply for one) might not ask for the same languages anymore, but there will always be an old code base that at least needs to be maintained.


That is definitely true. On the other hand, maintaining legacy code is hell. Fixing code you wrote 6 month ago yourself is already terrible, fixing code others wrote 6 years ago can kill you.
tofucake
Profile Blog Joined October 2009
Hyrule19188 Posts
November 19 2015 15:11 GMT
#13569
My codebase is 24 years old :D
Liquipediaasante sana squash banana
Manit0u
Profile Blog Joined August 2004
Poland17588 Posts
November 19 2015 15:45 GMT
#13570
We have one developer who's working with Delphi. Part of the reason he got hired
Time is precious. Waste it wisely.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
November 19 2015 17:42 GMT
#13571
On November 19 2015 22:00 Morfildur wrote:
Show nested quote +
On November 19 2015 07:31 spinesheath wrote:
On November 19 2015 04:14 WarSame wrote:
Si, senor. That's surprising. I was under the impression the large majority of SEs used C or C++.

I suggest you look through a bunch of job offers of employers in your region and/or employers you'd like to work for and find out what languages they are hiring for. Job offers in the future (when you actually apply for one) might not ask for the same languages anymore, but there will always be an old code base that at least needs to be maintained.


That is definitely true. On the other hand, maintaining legacy code is hell. Fixing code you wrote 6 month ago yourself is already terrible, fixing code others wrote 6 years ago can kill you.

It's rare to get a job where you don't have to work with old code in one way or another. Better accept that possibilty and be prepared for it than ignoring it.
If you have a good reason to disagree with the above, please tell me. Thank you.
Itsmedudeman
Profile Blog Joined March 2011
United States19229 Posts
Last Edited: 2015-11-19 17:52:38
November 19 2015 17:47 GMT
#13572
Am I the only one who actually enjoys refactoring code? Every time I refactor my own code it feels like I just lost 100 pounds. It does suck tho when it's just completely fucked up from the core and it's better to just rewrite it.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
November 19 2015 17:56 GMT
#13573
On November 20 2015 02:47 Itsmedudeman wrote:
Am I the only one who actually enjoys refactoring code? Every time I refactor my own code it feels like I just lost 100 pounds of weight. It does suck tho when it's just completely fucked up from the core and it's better to just rewrite it.

I actually do like refactoring if I get the time to do it properly. Sadly that's usually not the case because stuff needs to get done.
Rewriting legacy code (that is in use) from scratch is usually a bad idea beacuse by the time you're done rewriting you'll be faced with a huge amount of incompatabilities that stem from bugs in the legacy code (that have been worked around) AND your own code. It's better to develop a plan how to refactor the legacy code in small steps and then do those one by one.
If you have a good reason to disagree with the above, please tell me. Thank you.
Nemphis
Profile Joined August 2011
Belgium1 Post
November 19 2015 21:05 GMT
#13574
On November 17 2015 05:46 tofucake wrote:
Show nested quote +
On November 17 2015 05:06 WarSame wrote:
What are your opinions on the best Javascript IDE? Writing it normally is kinda painful. I tried WebStorm and it looked good but it costs money. What are good free options?

At my company devs use a mix of Sublime (me and another guy), Atom (one guy), and something else (other guy on a different project). I personally love Sublime, and you can get some extensions to make autocompletes and code-aware upgrades.


I personally really like atom, but if you want an editor for web-based stuff, you could give brackets a try.
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
November 19 2015 22:26 GMT
#13575
On November 18 2015 22:35 Faust852 wrote:

I was wondering, should I take a Client-Server type of approach, like the Server side is handling the Model-Controler type of things, and a second part, the Client, just handling the View and sending request to the Controler on the Server ?

Yes this sounds good


And is the networking part be handled by the Model, or by the Controler ?

All the logic should be handled by controllers, models are just there to hold values.
The harder it becomes, the more you should focus on the basics.
Faust852
Profile Joined February 2012
Luxembourg4004 Posts
November 20 2015 18:09 GMT
#13576
On November 20 2015 07:26 sabas123 wrote:
Show nested quote +
On November 18 2015 22:35 Faust852 wrote:

I was wondering, should I take a Client-Server type of approach, like the Server side is handling the Model-Controler type of things, and a second part, the Client, just handling the View and sending request to the Controler on the Server ?

Yes this sounds good

Show nested quote +

And is the networking part be handled by the Model, or by the Controler ?

All the logic should be handled by controllers, models are just there to hold values.


Thank you
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2015-11-21 00:26:21
November 21 2015 00:24 GMT
#13577
On November 18 2015 17:30 Manit0u wrote:
Show nested quote +
On November 18 2015 11:27 phar wrote:
+ Show Spoiler +

On November 17 2015 18:12 Itsmedudeman wrote:
I meant something that could look like


if(count == 500) {
s++;
if(s > 59) {
m++;
s = 0;
if(m > 59) {
h++;
m = 0;
if(h > 12)
h = 0;
}
}
}

I could probably think of a better example where it just looks unreadable, but you get my point.


In that instance it sounds like you're trying to replicate some timer logic. The answer to that specific domain then is to use a proper library to handle clock state for you, instead of re-inventing the wheel.


Or, if say you're working in embedded C on a microcontroller (having personally written something roughly like that in embedded C before lol), maybe you don't have access to a proper clock library. But you can structure it more cleanly:

int const ticks_per_second = 500;
...
// I don't know how your system is, but might be that one or more of these
// are modified in a volatile context (interrupt, w/e). change as needed
volatile int counter;
volatile int seconds;
volatile int minutes;
volatile int hours;

...

if(counter % ticks_per_second == 0) {
increment_seconds();
}

...

increment_seconds() {
seconds = (seconds + 1) % 60;
if (!seconds) { // I'm lazy shoot me
increment_minutes();
}
}

...
so on and so forth




Now in a better situation you build up a proper time library, which doesn't even keep track of seconds, minutes, hours individually. Just calculate that shit on the fly when you need it:

int const ticks_per_second = 500;
...
// Now we store only counter, and derive everything else.
volatile int counter;

int getSeconds() {
return counter / ticks_per_second;
}

int getMinutes() {
...


Now I realize this doesn't answer your general case, but usually if you get wonky logic you may be able to abstract something out.


Nice. Just out of curiosity, was my answer to him any good? I'd like for someone obviously more knowledgeable in C than me to give a comment on this little monster I've created. I really need to work my C-foo back up a bit

http://www.teamliquid.net/forum/general/134491-the-big-programming-thread?page=677#13538


Sorry I didn't see it earlier. Without more details then yea, generally breaking the incrementing out into smaller readable chunks helps. This isn't really a C-specific concern though, you'd find the same problem in Java, C++, etc. Idk about the other wrappers, my C is too rusty.

I was just pointing out the fact that it looked like embedded timer code, and thus you might not actually need all those variables incremented every time.
Who after all is today speaking about the destruction of the Armenians?
Acrofales
Profile Joined August 2010
Spain18179 Posts
November 21 2015 01:12 GMT
#13578
On November 20 2015 07:26 sabas123 wrote:
Show nested quote +
On November 18 2015 22:35 Faust852 wrote:

I was wondering, should I take a Client-Server type of approach, like the Server side is handling the Model-Controler type of things, and a second part, the Client, just handling the View and sending request to the Controler on the Server ?

Yes this sounds good

Show nested quote +

And is the networking part be handled by the Model, or by the Controler ?

All the logic should be handled by controllers, models are just there to hold values.

In this case I agree, but in general, I would say that your model exists to abstract away from your values. If you store the time in milliseconds, but are only ever interested in whether it is morning, afternoon or night, that is "logic" that your model should do. Your model should provide the appropriate and necessary information. Often that's just passing on values, but it can require computation.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
November 21 2015 23:54 GMT
#13579
Is this an accurate statement:

In Java, an interface is a collection of methods that will be used by any class that implements the interface.
Prillan
Profile Joined August 2011
Sweden350 Posts
November 22 2015 00:01 GMT
#13580
On November 22 2015 08:54 travis wrote:
Is this an accurate statement:

In Java, an interface is a collection of methods that will be used by any class that implements the interface.

You're correct, if you mean "has to be implemented by" instead of "will be used by".

I'd write something like: An interface is a collection of method signatures that has to be implemented in all classes that implement the interface.
TheBB's sidekick, aligulac.com | "Reality is frequently inaccurate." - Douglas Adams
Prev 1 677 678 679 680 681 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 5h 48m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
White-Ra 211
Ketroc 29
StarCraft: Brood War
Artosis 785
Sharp 380
zelot 261
Bale 90
Shine 78
Sexy 64
Noble 34
ZergMaN 30
GoRush 19
Hm[arnc] 11
Dota 2
monkeys_forever250
NeuroSwarm109
Counter-Strike
summit1g8556
fl0m6307
minikerr35
Other Games
tarik_tv6482
JimRising 474
KnowMe62
ViBE62
Liquid`Ken15
Organizations
Other Games
gamesdonequick5335
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Hupsaiya 102
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• RayReign 25
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Scarra1703
• Rush855
Upcoming Events
Replay Cast
5h 48m
Wardi Open
10h 48m
Monday Night Weeklies
13h 48m
WardiTV Invitational
1d 8h
WardiTV Invitational
2 days
The PondCast
3 days
OSC
3 days
OSC
4 days
All Star Teams
4 days
INnoVation vs soO
sOs vs Scarlett
uThermal 2v2 Circuit
5 days
[ Show More ]
All Star Teams
5 days
MMA vs DongRaeGu
Rogue vs Oliveira
Sparkling Tuna Cup
6 days
OSC
6 days
Liquipedia Results

Completed

Proleague 2026-01-11
Big Gabe Cup #3
NA Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL 21 Non-Korean Championship
CSL 2025 WINTER (S19)
OSC Championship Season 13
Underdog Cup #3
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025

Upcoming

Escore Tournament S1: W4
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Rongyi Cup S3
Thunderfire SC2 All-star 2025
Nations Cup 2026
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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...

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.