• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 12:58
CEST 18:58
KST 01: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] Ro16 Preview: Rough Waters10[ASL22] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244
Community News
Weekly Cups (Aug 30-Sep 7): herO thrives amid growing schism10Official StarCraft website teases new content ahead of BlizzCon?134Stellar Fest TWO the Moon (Dec 16-20)9Weekly Cups (August 24-30): Patches' balance mod takes over3New 3v3 BGH Ladder (and more) on ShieldBattery!46
StarCraft 2
General
Balance hotfix patch 5.0.16b (July 16) Team Liquid Map Contest #22: Results and Winners Weekly Cups (Aug 30-Sep 7): herO thrives amid growing schism SC4ALL: II Winner will earn a spot at HSC 30! SC4ALL II: StarCraft 2 Player Announcement 7/8
Tourneys
RSL goes to London! 2026 Offline Finals Nov 21-22 KSL Week #92 IntoTheTV X SOOP SC2 League : Weekly & Monthly 2026 GSTL Announcement Sparkling Tuna Cup - Weekly Open Tournament
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 542 The Ascended Mutation # 541 Binary Choice The PondCast: SC2 News & Results Mutation # 540 Dodge This
Brood War
General
Official StarCraft website teases new content ahead of BlizzCon? BGH Auto Balance -> http://bghmmr.eu/ Practice Partners (Official) Broodwar Prediction Market [D] Brainstorming a balance patch for Brood war
Tourneys
[ASL22] Ro16 Group A [ASL22] Ro16 Group B Escore Tournament - Season 3 Small VOD Thread 2.0
Strategy
Replay Review Process - What do you do? Simple Questions, Simple Answers Odyssey Mineral Stack Saturation Game Theory for Starcraft
Other Games
General Games
Nintendo Switch Thread EVE Corporation Diablo IV [Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Trading/Investing Thread Russo-Ukrainian War Thread European Politico-economics QA Mega-thread
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Movie Discussion!
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
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Virtual Romance, Real-Life C…
TrAiDoS
Regacy Esports:Our Goa…
regacyesports
Dreaming of BW patches (mod…
c3rberUs
LOCKPICKING NOOB
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 6062 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
Poland17843 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
Poland17843 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
Poland17843 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
Poland17843 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 2m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Tasteless 221
SpeCial 191
BRAT_OK 39
MindelVK 17
StarCraft: Brood War
Britney 30544
Calm 4760
Shuttle 983
firebathero 622
Artosis 379
actioN 232
910 91
Dewaltoss 87
Bonyth 78
Mini 62
[ Show more ]
Liquid`Ret 56
Mong 52
Rock 25
Hm[arnc] 17
Pusan 16
SilentControl 9
Noble 5
Dota 2
qojqva3152
Dendi1467
420jenkins338
LuMiX1
Counter-Strike
fl0m1065
Fnx 625
edward18
Heroes of the Storm
Liquid`Hasu375
Trikslyr1
Other Games
singsing1436
Grubby1353
B2W.Neo821
XaKoH 138
QueenE36
Organizations
Other Games
EGCTV1227
StarCraft 2
StarCraft791
Heroes of the Storm
Heroes of the Storm472
[ Show 16 non-featured ]
StarCraft 2
• 3DClanTV 86
• poizon28 74
• StrangeGG 48
• Migwel
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
StarCraft: Brood War
• Airneanach20
• FirePhoenix10
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 4302
League of Legends
• Jankos1716
Other Games
• Shiphtur178
Upcoming Events
AI Arena Tournament
2m
Laughngamez YouTube
OSC
3h 32m
Sparkling Tuna Cup
17h 2m
WardiTV Invitational
18h 2m
ByuN vs Percival
Cure vs Classic
Shopify Rebellion Sundays
22h 2m
Spirit vs Mixu
Clem vs TBD
RSL Revival
23h 2m
Serral vs Rogue
BlizzCon
1d 1h
IdrA vs MC
Replay Cast
1d 7h
Afreeca Starleague
1d 17h
Light vs JyJ
Soulkey vs hero
WardiTV Weekly
1d 18h
[ Show More ]
Monday Night Weeklies
1d 23h
Afreeca Starleague
2 days
Snow vs Shinee
Shine vs EffOrt
GSL
2 days
PiGosaur Cup
3 days
The PondCast
3 days
Kung Fu Cup
3 days
Replay Cast
4 days
KCM Race Survival
4 days
IntoTheTV X SOOP
4 days
Replay Cast
5 days
IntoTheTV X SOOP
5 days
Replay Cast
6 days
GSL
6 days
Liquipedia Results

Completed

Acropolis #5 - TRS
PiG Sty Festival 8.0
Big Dog Cup 2026 Div 1

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL 2026 AUTUMN (S22)
Acropolis #5
RSL Revival: Season 6
Calamity Invitational
FISSURE Playground #3
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026

Upcoming

Blizzard Classic Cup 2026
Acropolis #5 - GSA
Acropolis #5 - GSB
Acropolis #5 - GSC
SC4ALL II: Brood War
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
Blizzard Classic Cup 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
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
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.