|
Totally right, the format enhances transparency.
Only well formatted and commentented code enables to work other programmers than the original coder on the source.
AND: in well formatted code experienced programmers see the quality or bugs at first side.
|
|
|
|
|
All code must go through a development/debug/maintenance cycle.
Right.
In the land of Oz. I've preached that to various companies (like Robot Research, eventually bought by Sensormatic), or like Integration Partners, when I worked for them. Management barely understand why a debug cycle is necessary ("can't you just program it without bugs???") and I've never been able to convince any manager that a product needs to be funded for the maintenance cycle, let alone a phase-out cycle.
I'm sick of it all, which is why I'm a consultant now. And I'm sick of it enough that I'm naming the bozo places I used to work for, otherwise, there will never be accountability.
As far as style goes, other than getting the naming convention right, it's cheaper to buy a code formatter than to get two people, let alone 10 or 20, to agree on style.
Marc
|
|
|
|
|
Poor programmers usually suck at both code formatting and code performance.
If you see a bad looking code you can be sure it will give you a headache.
|
|
|
|
|
George wrote:
Poor programmers usually suck at both code formatting and code performance.
It depends!
I like to indent a la MS-stlye, I use a lot of blank lines to separate program functionality etc. I hate Java-formatting style
However I have collegues that do not use blank lines, use Java-indentation etc. But, their code is good, just does not look nice to me.
Best regards,
Alexandru Savescu
|
|
|
|
|
Alexpro wrote:
It depends!
Of course!
Alexpro wrote:
However I have collegues that do not use blank lines, use Java-indentation etc. But, their code is good, just does not look nice to me.
Well, I am not talking about Java-style vs MS-Style. I am rather talking about having and not having a style. Some people really can make a code look unreadable, because they don't format it at all.
|
|
|
|
|
bla bla bla whaterver dude bla bla bla
|
|
|
|
|
I guess you are a spew coder then?
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
I agree with that statement.
I think its a matter of pride. I want it to look good and work good.
If my seniors and principles look at my code or go through a code review and it looks like garbage and confusing then i did not do my job!
My job is to write clear and concise code that works according to spec.
mike
Mike "Badvox"
|
|
|
|
|
You obviously have never programmed in assembly where all code looks like meeningless sh*t
|
|
|
|
|
It does?
When doing assembler you just have to be even MORE carefull about formatting and clarifications, otherwise you will most likely end up with a thousand lines of unusable garbage.
I have seen asm code that was just one step from C, and other code that was a pile of s**t, mnemonics and numbers.
"After all it's just text at the end of the day. - Colin Davies
|
|
|
|
|
George wrote:
Poor programmers usually suck at both code formatting and code performance.
I could out indent and out format you into the next solar system. Why? From my HTML work I have learnt to format like the devil. It means a lot in HTML.
But no way in hell I could out programme you in C++.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Alison Pentland wrote:
I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!
|
|
|
|
|
I am a zealot for coding standards, but no-one in their right mind can say that formatting is equally important to performance, I mean, which does the user *see* ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
That depends on what you are looking at.
If you are looking at the here and now then by all means current performance means everything.
But if you look at the lifetime of an application the extra time it takes to maintain the poorly formatted code could add a lot more time than the few extra cycles you save by using a particular way of doing things.
Personally I go for readability, as you could tell from my stance on casting etc Then again 90% of what I have written are database applications where communicating with the server takes far longer than saving a few cycles will be worth.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
James T. Johnson wrote:
But if you look at the lifetime of an application the extra time it takes to maintain the poorly formatted code could add a lot more time than the few extra cycles you save by using a particular way of doing things.
I think you missed my point.
James T. Johnson wrote:
If you are looking at the here and now then by all means current performance means everything.
Current performance IS everything. But to be honest, what I was trying to say is that I do not see the dichotomy, but if I had to choose, performance is the winner.
James T. Johnson wrote:
Personally I go for readability, as you could tell from my stance on casting etc
I hope you're being ironic.... A major reason I hate all that casting is that C# is hard to read at times because it's too verbose.
Overall my point ( obviously poorly made ) is that there is no dichotomy but if a false one is to be imposed by the poll, then performance is obviously number one, although I think performance is likely to *improve* if the code is well formatted, because it's easier for people to go back and change other peoples code to make improvements if it is easy to read.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Christian Graus wrote:
I think you missed my point.
Probably
Christian Graus wrote:
I hope you're being ironic.... A major reason I hate all that casting is that C# is hard to read at times because it's too verbose.
I don't find it that hard to read; but it depends on how you are doing it.
If I have to cast, I prefer to store the result in a variable so I don't have to cast again.
I also prefer to have only one or two member access per line.
Not my style
((BarRow) ((Foo) fooCollection[4]).Rows[3]).Baz();
My style
Foo foo = (Foo) fooCollection[4];<br />
BarRow barRow = (BarRow) foo.Rows[3];<br />
<br />
barRow.Baz();
Which I think is the kind of formatting vs performance that the survey was asking about. Here a few cycles are wasted because it stores the results of each line in a variable; only to be used once.
I would think that a good optimizing compiler would see that this is the case so it would compile down to the better version; but I've seen weird bugs with the VC6 optimizer (a simple 'center in window' type function was messed up).
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Christian Graus wrote:
Current performance IS everything
Well, let's see. If you have function refreshing the window which takes 1e-6 seconds, how much time (max) would you like to spent to improve the performance 10 times?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Tomasz Sowinski wrote:
Well, let's see. If you have function refreshing the window which takes 1e-6 seconds, how much time (max) would you like to spent to improve the performance 10 times?
It doesn't matter what I say, does it ?
As I said before, in the false dichotomy between pretty code and performance, performance is more important. That does not mean we need to keep optimising when performance is perfectly acceptable.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Performance is always less important with modern computers.What is more important is that it doesen't crash!
|
|
|
|
|
I'm agree with you. If the app don't work well, really isn't important how fast it crash.
------------------------------------------------------
May be you think "He's crazy", but i'm not the only one.
|
|
|
|
|
Christian Graus wrote:
A major reason I hate all that casting is that C# is hard to read at times because it's too verbose.
Good God, somebody finally admitted it! And all that casting must be typed as well!
MK
|
|
|
|
|
In actual fact, Eric Gunnerson from Microsoft recently admitted on the C# board that even the C# team thinks you need to cast too much.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
Why should we care about users?
Let's kill them all and just code for coders!
- - - - - - - - - - - - - - - - - -
Memory leaks is the price we pay \0
01234567890123456789012345678901234
|
|
|
|
|
It's not about the user; it's an issue of life-cycle cost. I've probably maintained as much code as I've designed, and have wasted many manhours of precious time slogging through perfectly functional, but very ugly code. There may be programs that are written once and delivered, without anyone ever having to revisit them. But I'll bet they're rare. And the poor sap who has to implement the changes required over time is almost never the same programmer that wrote the original.
On a related note, those who do program maintenance need to be very clear in documenting the changes made, and the reasons for the changes, for the next guy in the maintenance queue. It's not strictly necessary that maintainers retain the original style, but it helps!
<marquee>"Knock, knock." "Who's there?" "Recursion." "Recursion who?" "Knock, knock..."
|
|
|
|
|
I agree with you 100% on all fronts. My point really was that there is no dichotomy, the idea that we could spend the time we spend making the code pretty improving performance is plain wrong. I was really trying to say that I had to choose performance over pretty code in the poll, but that the question itself is flawed.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|