• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 15:58
CET 21:58
KST 05:58
  • 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
[ASL22] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5
Community News
Weekly Cups (Oct 26 - Nov 1): MaxPax, herO, Solar win0Weekly Cups (October 19-25): Clem triples first in 5.0.175Evil Geniuses - shutting down23ISSL (IntoTheTV x SOOP SC2 League): Premier7Weekly Cups (October 12-18): 5.0.17 era begins1
StarCraft 2
General
No more SC2 streamers on team liquid? [D] Hacker peak in sc2 ? Liquibets sc2 season 30 Evil Geniuses - shutting down Weekly Cups (Oct 26 - Nov 1): MaxPax, herO, Solar win
Tourneys
SC4ALL: II Venue Change Announcement! Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays ISSL (IntoTheTV x SOOP SC2 League): Premier Stellar Fest TWO the Moon (Dec 16-20)
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
[G] How to playtest arcade maps Starcraft 2 Advance [D] the control group Simple Questions/Answers
External Content
Mutation # 550 Graveyard Shift The PondCast: SC2 News & Results Mutation # 549 Endless Sparkles Mutation # 548 Shining Bright
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Rollback Netcode in Brood War SC4ALL: II Venue Change Announcement! Ziemie's Starcraft 1 Prequel Campaign 🇺🇦 Ukrainian StarCraft:BroodWar community reborn
Tourneys
[Megathread] Daily Proleagues Small VOD Thread 2.0 [$1250] International ShieldBattery League KCM Race Survival 2026 Season 4
Strategy
50,000-Word Terran Builds Memo 2026-10-22 Cliff Jump Revisited (1 in a 1000 strategy) Simple Questions, Simple Answers
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Deus Ex 3!? Mobile Legends: Bang Bang Armies of Exigo - YesYes?
Dota 2
Dota 2 Champions League Season 3 Begins April 25!
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Dating: How's your luck? Trading/Investing Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread
Fan Clubs
Fan Club Resource Thread Reynor Fan Club The Flash Fan Club
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts
Blogs
Why I built Repalyzer (1.1.…
BlueStar
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
[ASL22] Ro4 Day1 Ticket Giv…
bITt.mAN
Can Bots Beat Pros?? Starcr…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 10609 users

The Big Programming Thread - Page 563

Forum Index > General Forum
Post a Reply
Prev 1 561 562 563 564 565 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.
Manit0u
Profile Blog Joined August 2004
Poland17871 Posts
Last Edited: 2015-01-10 00:00:39
January 09 2015 23:59 GMT
#11241
There's real code and academic code. If you had all the time in the world then sure, make your code as beautiful as you want, add any amount of abstraction you want etc. In reality, you get to work on some project, most likely you join it in the middle or near the end of development cycle. You have a deadline that doesn't allow you to do much (Unit testing? You're joking, right?). What counts there is that you look at a single piece of code from the framework you haven't seen before and you must know what to do with it. It's all that matters, you don't have 2 days to spare figuring out how the entire framework is built and what's going on under the hood, you must do x in feature y by the end of date z - that's all that concerns you.

In such situations you don't care how badly the code is formatted, if it's commented or not. All you care about is if you see a small piece of code taken from a bigger project and with just this small piece how fast can you either alter it or use it to get specific result in your timeframe.

In the beginning I was a big proponent of all the "clean code", SOLID and all that stuff. Right now I'm in favor of duct tape programming. But I never forget about the past, so if I ever find a badly formatted or badly written code and I have a minute or two to spare I'll make even a small piece of it better. This way, as I work through numerous tasks I'm not only introducing new code that's "good enough" in my eyes, I slowly make improvements to the old code to meet the same standards.

On another note, do you also hate it when you encounter this?


catch (Exception $ex) {
// do nothing
}
Time is precious. Waste it wisely.
Xyik
Profile Blog Joined November 2009
Canada728 Posts
January 10 2015 00:21 GMT
#11242
I feel like people who speak of 'elegant' code and 'beautiful' code have not had to deal with large-scale development on a real production code base ... good code is : efficient, re-usable, maintainable and easy to understand, thats it. No tricks, no cleverness, no abstract concepts that make good code.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2015-01-10 01:27:31
January 10 2015 01:27 GMT
#11243
is there something to be said about completely abstract code
beyond vacuous hogwash and tired truisms?

i think not!
conspired against by a confederacy of dunces.
Manit0u
Profile Blog Joined August 2004
Poland17871 Posts
January 10 2015 02:27 GMT
#11244
I guess it depends on what do you consider an abstract code. If you use a layer of abstraction to make it more readable and easier to use then by all means do so, but if you start introducing multiple layers of abstraction just for the sake of making it abstract you're most likely doing something wrong.

I'm not the most experienced developer around so I might be wrong on this though.
Time is precious. Waste it wisely.
LaNague
Profile Blog Joined April 2010
Germany9118 Posts
Last Edited: 2015-01-10 02:34:55
January 10 2015 02:33 GMT
#11245
On January 09 2015 08:53 darkness wrote:
Show nested quote +
On January 08 2015 10:12 LaNague wrote:
I thinkgood programming is something similar to good painting.


You have to have a brain for it and you have to practice technique.
No matter how much i practiced for my stupid art aclasses in school, in 12 years i did not produce a single good looking picture.
And similar, some people in my university are incapable of producing good code, their brain isnt made for it.

But university CS degrees arent about programming, you learn mostly other stuff and have some basic programming classes.
Same as an art degree is probably not painting things all week (i think?).



hey what would you recommend to programm a little 3d video game? i heared c++ is the best for this?

what libaries would i need besides opengl? i would need something to load files with sound, images, 3d models etc. Which SDK can offer all that. I am looking for something that makes life easy. But i want to go the professional way




that totally depends.
If you just want to get it over with and design your game and dont care that you cant really tune everything, then Unity or a similar engine. It can also be used in C# for example.

If you are in it for the experience or need something custom, then you need C++ with either directX or openGL.


Also, there are shades between those 2 options, but im not a game programmer so i dont know whats hot right now regarding that.


Come on, this is bullshit. You should probably define what you mean by good code, but if you mean readable, then all it takes is to read the book 'Clean Code' by Robert Martin. I don't think one has to have an excellent brain, it is just a discipline.





http://www.eis.mdx.ac.uk/research/PhDArea/saeed/paper1.pdf


here, bullshit right back to you
nunez
Profile Blog Joined February 2011
Norway4003 Posts
January 10 2015 02:50 GMT
#11246
On January 10 2015 11:27 Manit0u wrote:
I guess it depends on what do you consider an abstract code. If you use a layer of abstraction to make it more readable and easier to use then by all means do so, but if you start introducing multiple layers of abstraction just for the sake of making it abstract you're most likely doing something wrong.

I'm not the most experienced developer around so I might be wrong on this though.

literally abstract code.

existing in thought or as an idea but not having a physical or concrete existence.
conspired against by a confederacy of dunces.
ZenithM
Profile Joined February 2011
France15952 Posts
Last Edited: 2015-01-10 03:20:46
January 10 2015 03:10 GMT
#11247
On January 10 2015 05:41 spinesheath wrote:
Show nested quote +
On January 10 2015 05:25 ComaDose wrote:
but what if you can make it work faster with a more convoluted method? good code is also a function of the requirements and weighted criteria.

Then there's a good chance I'll scold you for thinking about optimization before profiling. Also then there likely is a way to make it faster without convoluting the code.

Hmm. No? There are plenty of examples of more complex algorithms (more "convoluted" if you will, and definitely harder to read) that solve the same problem as the clean naive understandable way but with better complexity (so, faster for large enough instances). Going from O(n^3) to O(n^2.81) is sometimes worth the work and the harder readability.

I think ComaDose was right in that what makes the code good largely depends on what it needs to achieve in which circumstances.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
January 10 2015 09:40 GMT
#11248
On January 10 2015 08:59 Manit0u wrote:
On another note, do you also hate it when you encounter this?


catch (Exception $ex) {
// do nothing
}

It's not as bad as the same thing without any comment at all. In your case, at least there's hope that someone spent a moment to consider if this piece of code works properly. Still, they likely eat a whole suite of exceptions that they didn't mean to eat.

On January 10 2015 12:10 ZenithM wrote:
Show nested quote +
On January 10 2015 05:41 spinesheath wrote:
On January 10 2015 05:25 ComaDose wrote:
but what if you can make it work faster with a more convoluted method? good code is also a function of the requirements and weighted criteria.

Then there's a good chance I'll scold you for thinking about optimization before profiling. Also then there likely is a way to make it faster without convoluting the code.

Hmm. No? There are plenty of examples of more complex algorithms (more "convoluted" if you will, and definitely harder to read) that solve the same problem as the clean naive understandable way but with better complexity (so, faster for large enough instances). Going from O(n^3) to O(n^2.81) is sometimes worth the work and the harder readability.

I think ComaDose was right in that what makes the code good largely depends on what it needs to achieve in which circumstances.

Again, a performance gain only ever matters if you 1) have a performance problem and 2) profiled the program to find the critical code. If you get a piece of code from O(n^10) to O(log(n)) but that code never was responsible for more than 1% of the runtime, you wasted development time and possibly readability.
Second part of the issue is that only a very small part of your code will ever be performance critical. The vast majority of it has next to no effect on performance. Obviously there may be a case where you have to sacrifice readability for performance, but in the grand scheme of things these parts are drowned by all the code that isn't performance critical. I'm not going to change the my opinion of what good code is just because <1% of a code base has a chance to require special treatment.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17871 Posts
January 10 2015 09:59 GMT
#11249
On January 10 2015 18:40 spinesheath wrote:
Show nested quote +
On January 10 2015 08:59 Manit0u wrote:
On another note, do you also hate it when you encounter this?


catch (Exception $ex) {
// do nothing
}

It's not as bad as the same thing without any comment at all. In your case, at least there's hope that someone spent a moment to consider if this piece of code works properly. Still, they likely eat a whole suite of exceptions that they didn't mean to eat.


The comment was added by me. I see catch (Exception $ex) {} on a daily basis... Annoys the hell out of me.
Time is precious. Waste it wisely.
berated-
Profile Blog Joined February 2007
United States1134 Posts
Last Edited: 2015-01-10 11:25:36
January 10 2015 11:24 GMT
#11250
On January 10 2015 18:59 Manit0u wrote:
Show nested quote +
On January 10 2015 18:40 spinesheath wrote:
On January 10 2015 08:59 Manit0u wrote:
On another note, do you also hate it when you encounter this?


catch (Exception $ex) {
// do nothing
}

It's not as bad as the same thing without any comment at all. In your case, at least there's hope that someone spent a moment to consider if this piece of code works properly. Still, they likely eat a whole suite of exceptions that they didn't mean to eat.


The comment was added by me. I see catch (Exception $ex) {} on a daily basis... Annoys the hell out of me.


Assuming that this isn't an example where one was just too lazy to check the error condition and instead lets it throw an exception...

I've iterated to logging something out in these cases if I'm going to catch instead of the do nothing comment...usually wrapped in a debug enabled statement so it normally doesn't do anything. It's equivalent in cases where the logger is not set to debug, and _way_ better when you know to know why you are getting into that exception block.

On January 10 2015 08:59 Manit0u wrote:
There's real code and academic code. If you had all the time in the world then sure, make your code as beautiful as you want, add any amount of abstraction you want etc. In reality, you get to work on some project, most likely you join it in the middle or near the end of development cycle. You have a deadline that doesn't allow you to do much (Unit testing? You're joking, right?). What counts there is that you look at a single piece of code from the framework you haven't seen before and you must know what to do with it. It's all that matters, you don't have 2 days to spare figuring out how the entire framework is built and what's going on under the hood, you must do x in feature y by the end of date z - that's all that concerns you.

In such situations you don't care how badly the code is formatted, if it's commented or not. All you care about is if you see a small piece of code taken from a bigger project and with just this small piece how fast can you either alter it or use it to get specific result in your timeframe.

In the beginning I was a big proponent of all the "clean code", SOLID and all that stuff. Right now I'm in favor of duct tape programming. But I never forget about the past, so if I ever find a badly formatted or badly written code and I have a minute or two to spare I'll make even a small piece of it better. This way, as I work through numerous tasks I'm not only introducing new code that's "good enough" in my eyes, I slowly make improvements to the old code to meet the same standards.


There is a lot of truth to this... I've seen it practiced and even for myself usually always prefer the duct tape solution even if its not the one chosen.

I've also seen what 15 years of duct tape solutions can do to a code base, especially when developers are coming and going. Some of them were probably good at the boy scout method (leaving it better than you found it ) type of approach that you mention. Others struggle... making changes is extremely difficult because being able to read the code and comprehend the effect of change you are introducing is either extremely time consuming or too difficult without giving up and pitching a rewrite.

After years of "duct taping", I've had the fortune over the past couple years of leading the new projects at our company while being given the time to try to write "clean code" and focusing on automated testing. Between the technical debt, slower velocity due to modifying a 15 yr old code base, and lack of automated regression testing... it's not hard to understand why management sees value in allowing for us to "try to get it right this time".

There is obviously a lot of value in taking the time to structure your code correctly and adding automated testing of some sort. I'm really curious to see whether it ends up being worth it and actually can lead to continued velocity over the years.
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
January 10 2015 11:32 GMT
#11251
On January 10 2015 20:24 berated- wrote:
Show nested quote +
On January 10 2015 18:59 Manit0u wrote:
On January 10 2015 18:40 spinesheath wrote:
On January 10 2015 08:59 Manit0u wrote:
On another note, do you also hate it when you encounter this?


catch (Exception $ex) {
// do nothing
}

It's not as bad as the same thing without any comment at all. In your case, at least there's hope that someone spent a moment to consider if this piece of code works properly. Still, they likely eat a whole suite of exceptions that they didn't mean to eat.


The comment was added by me. I see catch (Exception $ex) {} on a daily basis... Annoys the hell out of me.


Assuming that this isn't an example where one was just too lazy to check the error condition and instead lets it throw an exception...

I've iterated to logging something out in these cases if I'm going to catch instead of the do nothing comment...usually wrapped in a debug enabled statement so it normally doesn't do anything. It's equivalent in cases where the logger is not set to debug, and _way_ better when you know to know why you are getting into that exception block.

Show nested quote +
On January 10 2015 08:59 Manit0u wrote:
There's real code and academic code. If you had all the time in the world then sure, make your code as beautiful as you want, add any amount of abstraction you want etc. In reality, you get to work on some project, most likely you join it in the middle or near the end of development cycle. You have a deadline that doesn't allow you to do much (Unit testing? You're joking, right?). What counts there is that you look at a single piece of code from the framework you haven't seen before and you must know what to do with it. It's all that matters, you don't have 2 days to spare figuring out how the entire framework is built and what's going on under the hood, you must do x in feature y by the end of date z - that's all that concerns you.

In such situations you don't care how badly the code is formatted, if it's commented or not. All you care about is if you see a small piece of code taken from a bigger project and with just this small piece how fast can you either alter it or use it to get specific result in your timeframe.

In the beginning I was a big proponent of all the "clean code", SOLID and all that stuff. Right now I'm in favor of duct tape programming. But I never forget about the past, so if I ever find a badly formatted or badly written code and I have a minute or two to spare I'll make even a small piece of it better. This way, as I work through numerous tasks I'm not only introducing new code that's "good enough" in my eyes, I slowly make improvements to the old code to meet the same standards.


There is a lot of truth to this... I've seen it practiced and even for myself usually always prefer the duct tape solution even if its not the one chosen.

I've also seen what 15 years of duct tape solutions can do to a code base, especially when developers are coming and going. Some of them were probably good at the boy scout method (leaving it better than you found it ) type of approach that you mention. Others struggle... making changes is extremely difficult because being able to read the code and comprehend the effect of change you are introducing is either extremely time consuming or too difficult without giving up and pitching a rewrite.

After years of "duct taping", I've had the fortune over the past couple years of leading the new projects at our company while being given the time to try to write "clean code" and focusing on automated testing. Between the technical debt, slower velocity due to modifying a 15 yr old code base, and lack of automated regression testing... it's not hard to understand why management sees value in allowing for us to "try to get it right this time".

There is obviously a lot of value in taking the time to structure your code correctly and adding automated testing of some sort. I'm really curious to see whether it ends up being worth it and actually can lead to continued velocity over the years.

they should include writing clean code as a class in schools, reading others code without an explanation is just imposable
The harder it becomes, the more you should focus on the basics.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
January 11 2015 16:58 GMT
#11252
Is anyone here a game developer? What's the excuse of companies like Blizzard not to utilise 4+ cores CPU?
bangsholt
Profile Joined June 2011
Denmark138 Posts
January 11 2015 17:34 GMT
#11253
Their engines were written when dual core was new / There's not enough gain to go to 4+ cores?
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
January 11 2015 17:38 GMT
#11254
On January 12 2015 01:58 darkness wrote:
Is anyone here a game developer? What's the excuse of companies like Blizzard not to utilise 4+ cores CPU?

It won't increase their sales but increases development costs.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17871 Posts
Last Edited: 2015-01-11 18:45:51
January 11 2015 18:45 GMT
#11255
Fun thing regarding game development and optimization:

[image loading]
[image loading]
Time is precious. Waste it wisely.
LaNague
Profile Blog Joined April 2010
Germany9118 Posts
Last Edited: 2015-01-11 20:41:02
January 11 2015 20:39 GMT
#11256
On January 12 2015 01:58 darkness wrote:
Is anyone here a game developer? What's the excuse of companies like Blizzard not to utilise 4+ cores CPU?




Its difficult to make your game scale with as many cores as are available, really really difficult.
Most devs go with as many fixed cores as they can easily develop for


With fixed cores you can for example make parts of the game run on different cores, like sound, physics, main game.
But for scalable cores you want all parts run on all cores, so first you need to develop your software in a way that parts can be run independandly of other parts in resources and in time.
And then you need to develop a scheduler who assigns independent work to all cores, preferrably guessing which work needs to be done in the future and assign this to idle cores.



This is because when using cores, you have to synchronize them in some way, you cant just run 25% of all work on all 4 cores because in the end programs have a sequence of commands that are run one after the other.
This synchronizing, when done wrong, can either lock things up or make them run very slowly(cores withing on other cores to finish and if sone in a circle everything locks up), or in other cases produce wrong results when 2 cores access to same resource at the same time.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
January 11 2015 21:37 GMT
#11257
On January 12 2015 05:39 LaNague wrote:
Show nested quote +
On January 12 2015 01:58 darkness wrote:
Is anyone here a game developer? What's the excuse of companies like Blizzard not to utilise 4+ cores CPU?

Its difficult to make your game scale with as many cores as are available, really really difficult.
Most devs go with as many fixed cores as they can easily develop for

Actually it's pretty easy to scale with a flexible number of cores as long as you do the hard part, which is designing your algorithm in a way that allows the bottleneck to be split up into a large number of independent tasks. Once you have an algorithm of the form
foreach(task in independentTasks) { task.Execute(); }
you can pick a multithreading framework of your choice, tell it to execute the loop in parallel, and it will distribute the load dynamically. No need to reinvent anything here.

The hard part is transforming the algorithm at the performance bottleneck. I have no idea what exactly the bottleneck is in Blizzard games, so I can't really tell just how hard it would be.

Usually the transformation comes with some overhead, so you need to run a bunch of performance tests on different numbers of cores and potentially come up with a way to switch to the sequential version of the algorithm in case you don't have enough cores to make the overhead worth it. That part is not very hard, but it's a lot of work.

But in the end it really is just too much work and thus too expensive for very little monetary gain.
If you have a good reason to disagree with the above, please tell me. Thank you.
Count9
Profile Blog Joined May 2009
China10928 Posts
January 11 2015 21:48 GMT
#11258
On January 12 2015 06:37 spinesheath wrote:
Show nested quote +
On January 12 2015 05:39 LaNague wrote:
On January 12 2015 01:58 darkness wrote:
Is anyone here a game developer? What's the excuse of companies like Blizzard not to utilise 4+ cores CPU?

Its difficult to make your game scale with as many cores as are available, really really difficult.
Most devs go with as many fixed cores as they can easily develop for

Actually it's pretty easy to scale with a flexible number of cores as long as you do the hard part, which is designing your algorithm in a way that allows the bottleneck to be split up into a large number of independent tasks. Once you have an algorithm of the form
foreach(task in independentTasks) { task.Execute(); }
you can pick a multithreading framework of your choice, tell it to execute the loop in parallel, and it will distribute the load dynamically. No need to reinvent anything here.

The hard part is transforming the algorithm at the performance bottleneck. I have no idea what exactly the bottleneck is in Blizzard games, so I can't really tell just how hard it would be.

Usually the transformation comes with some overhead, so you need to run a bunch of performance tests on different numbers of cores and potentially come up with a way to switch to the sequential version of the algorithm in case you don't have enough cores to make the overhead worth it. That part is not very hard, but it's a lot of work.

But in the end it really is just too much work and thus too expensive for very little monetary gain.

Yeah, essentially the game engine itself needs to be built for multi-threading from the ground up with all the associated overhead, which is substantial, figured out ahead of time. There's a reason the ratio of number of game engine developers vs number of game developers is at least 1:1000+; it's not something a kid straight out of college can do, or something you ship off to India and have them figure it out.

Sure, even without the engine fundamentally being multi-threaded you can always multi-thread afterwards, but that leads to exactly where we are now where 1 core does a huge majority of the work and the other cores still do a work but not nearly enough.

Game development is not a glamorous position (in terms of pay) and you need very talented engineers and time to figure out concurrency for something as complicated as a game engine.
Ben...
Profile Joined January 2011
Canada3485 Posts
January 11 2015 22:07 GMT
#11259
On January 10 2015 20:32 sabas123 wrote:
Show nested quote +
On January 10 2015 20:24 berated- wrote:
On January 10 2015 18:59 Manit0u wrote:
On January 10 2015 18:40 spinesheath wrote:
On January 10 2015 08:59 Manit0u wrote:
On another note, do you also hate it when you encounter this?


catch (Exception $ex) {
// do nothing
}

It's not as bad as the same thing without any comment at all. In your case, at least there's hope that someone spent a moment to consider if this piece of code works properly. Still, they likely eat a whole suite of exceptions that they didn't mean to eat.


The comment was added by me. I see catch (Exception $ex) {} on a daily basis... Annoys the hell out of me.


Assuming that this isn't an example where one was just too lazy to check the error condition and instead lets it throw an exception...

I've iterated to logging something out in these cases if I'm going to catch instead of the do nothing comment...usually wrapped in a debug enabled statement so it normally doesn't do anything. It's equivalent in cases where the logger is not set to debug, and _way_ better when you know to know why you are getting into that exception block.

On January 10 2015 08:59 Manit0u wrote:
There's real code and academic code. If you had all the time in the world then sure, make your code as beautiful as you want, add any amount of abstraction you want etc. In reality, you get to work on some project, most likely you join it in the middle or near the end of development cycle. You have a deadline that doesn't allow you to do much (Unit testing? You're joking, right?). What counts there is that you look at a single piece of code from the framework you haven't seen before and you must know what to do with it. It's all that matters, you don't have 2 days to spare figuring out how the entire framework is built and what's going on under the hood, you must do x in feature y by the end of date z - that's all that concerns you.

In such situations you don't care how badly the code is formatted, if it's commented or not. All you care about is if you see a small piece of code taken from a bigger project and with just this small piece how fast can you either alter it or use it to get specific result in your timeframe.

In the beginning I was a big proponent of all the "clean code", SOLID and all that stuff. Right now I'm in favor of duct tape programming. But I never forget about the past, so if I ever find a badly formatted or badly written code and I have a minute or two to spare I'll make even a small piece of it better. This way, as I work through numerous tasks I'm not only introducing new code that's "good enough" in my eyes, I slowly make improvements to the old code to meet the same standards.


There is a lot of truth to this... I've seen it practiced and even for myself usually always prefer the duct tape solution even if its not the one chosen.

I've also seen what 15 years of duct tape solutions can do to a code base, especially when developers are coming and going. Some of them were probably good at the boy scout method (leaving it better than you found it ) type of approach that you mention. Others struggle... making changes is extremely difficult because being able to read the code and comprehend the effect of change you are introducing is either extremely time consuming or too difficult without giving up and pitching a rewrite.

After years of "duct taping", I've had the fortune over the past couple years of leading the new projects at our company while being given the time to try to write "clean code" and focusing on automated testing. Between the technical debt, slower velocity due to modifying a 15 yr old code base, and lack of automated regression testing... it's not hard to understand why management sees value in allowing for us to "try to get it right this time".

There is obviously a lot of value in taking the time to structure your code correctly and adding automated testing of some sort. I'm really curious to see whether it ends up being worth it and actually can lead to continued velocity over the years.

they should include writing clean code as a class in schools, reading others code without an explanation is just imposable

It's not so much one class that teaches it, but enforcement of good code formatting/styling across all classes. Most universities have a "Programming Practices"-type class, but it can only do so much. At mine, that class was in second year and was mandatory, but by third year, most people were back to old habits and submitting mostly uncommented, awfully formatted nightmares outside of cases where it was required by the class (software engineering class, etc). Of the classes I took, most of the upper year classes asked for commented code, but outside of my systems programming class, there seldom were style/formatting guides used or enforced. It basically seems like a case of people not putting any thought into making actual clean, readable code unless there is incentive to do so.
"Cliiiiiiiiiiiiiiiiide" -Tastosis
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
January 11 2015 22:26 GMT
#11260
--- Nuked ---
Prev 1 561 562 563 564 565 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 14h 2m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 441
Vindicta 24
Nathanias 19
EmSc Tv 18
Nina 8
StarCraft: Brood War
Britney 12263
Shuttle 458
Dewaltoss 138
Shinee 40
Dota 2
qojqva2856
PGG 152
Counter-Strike
apEX2507
gobbtv542
zeus399
Heroes of the Storm
Liquid`Hasu569
Other Games
tarik_tv5701
Grubby3594
FrodaN997
shahzam346
PiGStarcraft240
Fuzer 214
C9.Mang0179
syndereN150
edward134
ArmadaUGS129
summit1g120
NeuroSwarm64
KnowMe38
ZombieGrub31
XaKoH 30
Railgan21
JuggernautJason18
ViBE6
Organizations
Other Games
BasetradeTV157
Counter-Strike
PGL130
StarCraft 2
EmSc Tv 18
EmSc2Tv 18
[ Show 18 non-featured ]
StarCraft 2
• StrangeGG 41
• Adnapsc2 19
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Laughngamez YouTube
• Migwel
StarCraft: Brood War
• Azhi_Dahaki39
• Michael_bg 6
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV767
League of Legends
• Nemesis2801
• Jankos2135
Other Games
• imaqtpie845
• Shiphtur473
Upcoming Events
IntoTheTV X SOOP
14h 2m
Reynor vs Solar
ByuN vs SHIN
Clem vs MaxPax
herO vs Rogue
IPSL
20h 2m
WorsT vs nOmaD
Dewalt vs andersOn
AI Arena Tournament
22h 2m
IntoTheTV X SOOP
1d 14h
IPSL
1d 20h
Azhi_Dahaki vs ggnore13
Double vs WIZARD
Replay Cast
2 days
Replay Cast
3 days
Sparkling Tuna Cup
3 days
WardiTV Invitational
3 days
YoungYakov vs Lambo
SHIN vs TBD
Percival vs Shameless
Solar vs TBD
PiGosaur Cup
4 days
[ Show More ]
The PondCast
5 days
KCM Race Survival
5 days
WardiTV Invitational
5 days
Liquipedia Results

Completed

Proleague 2026-11-05
Blizzard Classic Cup 2026
HCC Season 3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
IPSL Winter 2026-27
Calamity Cup Div. A Season 8
IEM Beijing 2026
PGL Masters Bucharest 2026
Stake Ranked Episode 5
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 2026

Upcoming

Sector 951
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
Underdog Cup 2026 Div 2-3
PGL Bucharest 2027
BLAST Bounty Winter 2027
eXTREMESLAND 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
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.