• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 18:54
CEST 00:54
KST 07:54
  • 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
Serral wins HomeStory Cup 2914Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
Balance hotfix patch 5.0.16b (July 16)58Reynor: GSL Loss Wasn't About Preparation Format16[IPSL] Spring 2026 Grand Finals - This Weekend!13Weekly Cups (July 6 - 12): Protoss strike back12BSL Season 22 Full Overview & Conclusion8
StarCraft 2
General
Balance hotfix patch 5.0.16b (July 16) Clem: "I don't have that much hope in Blizzard" [D] Wireframe Casting Removed Reynor: GSL Loss Wasn't About Preparation Format Is the larve respawn broken?
Tourneys
RSL Revival: Season 6 - Qualifiers and Main Event Master Swan Open (Global Bronze-Master 2) WardiTV Summer Cup 2026 GSL CK #5 Race War HomeStory Cup 29
Strategy
[G] Having the right mentality to improve
Custom Maps
New Map Maker - Looking for Advice - Love or Hate Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
Mutation # 535 Assembly of Vengeance The PondCast: SC2 News & Results Mutation # 534 Burning Evacuation Mutation # 533 Die Together
Brood War
General
NaDa’s Body Followup BW General Discussion ASL22 General Discussion Pros Debate: Zerg Unfairly Nerfed? (ASL S22 map) Etiquete rules in Asl?
Tourneys
[IPSL] Spring 2026 Grand Finals - This Weekend! [Megathread] Daily Proleagues Escore Tournament - Season 3 Small VOD Thread 2.0
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers Creating a full chart of Zerg builds Relatively freeroll strategies
Other Games
General Games
Nintendo Switch Thread Path of Exile Stormgate/Frost Giant Megathread General RTS Discussion Thread Beyond All Reason
Dota 2
Looking for a Dota Mentor 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
TL Mafia
TL Mafia Power Rank NeO.D_StephenKing vs This Guy From 1 Million Dance TL Mafia Community Thread Vanilla Mini Mafia
Community
General
How to buy a book - shipping from Korea to Europe US Politics Mega-thread Russo-Ukrainian War Thread The Games Industry And ATVI UK Politics Mega-thread
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
Movie Discussion! Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023 McBoner: A hockey love story Tennis[sport]
World Cup 2022
Tech Support
Simple Questions Simple Answers FPS when play League Of Legend on laptop How to clean a TTe Thermaltake keyboard?
TL Community
Northern Ireland Global Starcraft The Automated Ban List
Blogs
Role of Gaming on Mental Hea…
TrAiDoS
ASL S22 English Commentary…
namkraft
Poker (part 2)
Nebuchad
An Exploration of th…
waywardstrategy
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 19759 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
Poland17796 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
Poland17796 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
Poland17796 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
Poland17796 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 12h 6m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Ketroc 76
StarCraft: Brood War
Artosis 655
910 63
Purpose 11
Dota 2
syndereN744
NeuroSwarm142
League of Legends
rGuardiaN31
Super Smash Bros
hungrybox1143
Mew2King928
C9.Mang0484
Heroes of the Storm
Khaldor214
Other Games
Grubby3401
Liquid`RaSZi1738
ToD281
XaKoH 123
Organizations
Other Games
gamesdonequick2096
BasetradeTV295
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 16 non-featured ]
StarCraft 2
• Hupsaiya 133
• davetesta36
• RyuSc2 25
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Pr0nogo 5
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• imaqtpie1334
• Shiphtur630
Upcoming Events
WardiTV Weekly
12h 6m
Monday Night Weeklies
17h 6m
OSC
1d 1h
PiGosaur Cup
2 days
The PondCast
2 days
Kung Fu Cup
2 days
CrankTV Team League
3 days
Replay Cast
4 days
CrankTV Team League
4 days
Korean StarCraft League
5 days
[ Show More ]
RSL Revival
5 days
Online Event
5 days
Replay Cast
6 days
RSL Revival
6 days
Liquipedia Results

Completed

YSL S3
HSC XXIX
Eternal Conflict S2 E2

Ongoing

Acropolis #4
CSL 2026 Summer (S21)
KCM Race Survival 2026 Season 3
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
SCTL 2026 Spring
Eternal Conflict S2 E3
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026

Upcoming

Escore Tournament S3: W4
ASL S22 SEASON OPEN Day 2
Escore Tournament S3: W5
CSLAN 4
Blizzard Classic Cup 2026
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
Light Tournament 2026
Eternal Conflict S2 Finale
Stake Ranked Episode 4
Logitech G Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer 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.