Linked by Thom Holwerda on Wed 26th Sep 2012 23:25 UTC, submitted by MOS6510
General Development "Having read this, one realization is that better code often means less code. I don't think about lines of code exactly, or something similarly stupid, but in terms of meaningful code. However, argument for less code isn't about making code as compact as possible, avoid redundancy, etc. The argument is about not writing code at all whenever reasonable or possible. Should we focus on deciding what should and what should not built instead of polishing our software development craft then? Yes and no. Yeah, I know. Exactly the kind of answer you expected, isn’t it? Anyway, you can't answer this question meaningfully without a context."
Thread beginning with comment 536642
To view parent comment, click here.
To read all comments associated with this story, please click here.
by Lennie on Thu 27th Sep 2012 09:13 UTC in reply to "better or not"
Member since:

Programming languages are like other languages if you ask me.

An experienced programmer is probably more eloquent in defining what he/she wants the code to do when using programming languages and he/she is also more likely to be more eloquent in the programming language of choosen.

An experienced programmer is also more likely to make better code, which is more generic or to the point and probably also better at choosing which code should be to the point or generic.

So an experienced programmer is more likely to make better code and because of the eloquence you also get shorter code.

This means shorter code (because of the programmers experience and knowledge) is usually faster and all the other properties you mentioned.

But hey, that is just my opinion ;-)

Reply Parent Score: 2

RE: Eloquence
by Laurence on Thu 27th Sep 2012 11:04 in reply to "Eloquence"
Laurence Member since:

shorter code != faster code.

For instance, if I were writing a video codec, faster and better code would be using hardware frame buffers as opposed to purely software rendering. However using hardware acceleration adds a lot of code as well as complexity.

shorter code != maintainable code.

Modularising code can lead to easier debugging (as classes can be tested in isolation), and better maintainability in many cases too. However modularisation produces more verbose code.

However I think the OP was the most accurate when he stated that "Better code is better because it suits it's task better" - ie there is no definitive rule stating code most comply to x, y and z as the circumstances will vary depending on the project. (case in point, I've written some horrible kludges before because it made the most sense for that particularly project to patch the code in the crudest possible way given the time constraints and the (lack of) significance of the routine that was being patched).

Edited 2012-09-27 11:10 UTC

Reply Parent Score: 5

RE[2]: Eloquence
by Lennie on Thu 27th Sep 2012 11:07 in reply to "RE: Eloquence"
Lennie Member since:

My point was: if the programmer sucks at programming you'll probably end up with much more code which ends up doing the same thing just slower and probably more buggy.

Reply Parent Score: 2

RE[2]: Eloquence
by zhulien on Thu 27th Sep 2012 11:44 in reply to "RE: Eloquence"
zhulien Member since:

Agreed, shorter code much of the time is slower, it can sometimes be more difficult to understand if the complexity to make it shorter increases (not always). The fastest text output routine for example on the Amstrad CPC is about 2 kilobytes because it has masses of repeated LDIs and sequential arithmatic operations without many loops where-as the simplest is about 25 bytes - but takes ages comparison to render - important when you are trying to synchronize things in a Demo or Game, but less important when writing a business application - but then that 2 kilobytes might be more precious than the speed - ah such trade offs... to achieve 'better' code.

Reply Parent Score: 2

RE[2]: Eloquence
by DeepThought on Thu 27th Sep 2012 18:18 in reply to "RE: Eloquence"
DeepThought Member since:

shorter code != maintainable code.

Hell, no. Or yes ?! Your point is to general. I'm sure any decent programmer wrote code that proves your point correct and also wrong.

Reply Parent Score: 1