|
By that I mean "easy for me to maintain" since I'm the only person who has to maintain it.
That means:
- If there are any bugs I can find them and fix them.
- I can easily extend it.
- Others don't need to understand it (but that would be a bonus).
Fast and resource-efficient are much less important goals with modern hardware but my background (I'm really old ) has made such targets second-nature anyway.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
Phil J Pearson wrote:
Fast and resource-efficient are much less important goals with modern hardware [...]
Oohhhh... Be careful with that argument; that is the Java argument many of us have been hearing for quite some time now... But people have been trying to improve Java's performance for years.
Ever wonder why you would need to improve the performance of something? Well, I am sure that it is not because the performance was great in the first place...!
-=- James
Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"! Articles -- Products: Delete FXP Files & Check Favorites
|
|
|
|
|
This is a great point. Performance is a state of mind, a style almost. If you learn how to write code that is efficient, you can almost do it without thinking.
In .Net, there are some things that you can do that just need to become a force of habit. Things like not using an enumerator to iterate through arrays (have you looked at the IL generated when using a foreach on an array? ick.). Things like caching objects, caching collection counts (if you're sure they're not going to change) make a small, but in the longer term noticeable effect, especially if it saves you 4 calls inside of a tight loop.
Personally, I came into the software business from the hardware side of things. I see programmers excusing poor code as, "Well, the hardware is fast, so my code will be." Just because we have fast hardware, doesn't mean the coder should use it as an excuse to be lazy and write poor code.
|
|
|
|
|
While I agree that performance is important, it's not always reasonable to make extremely fast code until after you have the app up and running and know where your performance bottlenecks are. But that gets right back to easily maintainable code. When you get to the phase that you are doing performance benchmarking and have isolated the areas where you need to concentrate on, then the "maintainable code" will pay off because it will be easier to modify.
Ditto for bug-free code. While that is certainly desirable, all complex code will have bugs. If those bugs aren't caught until after the product ships, then it could be months if not years from the time you wrote the code to the time you get a bug report on it and have to go back to fix it. If it isn't easily maintainable, then that becomes a headache, and you spend a disproportionate amount of time figuring out what on earth you were doing -- instead of quickly fixing the bug and getting back to writing easily maintainable fast bug-free code...
|
|
|
|
|
Sorry, but it sounds like you (as many others here) are treating "Fast Code" and "Maintainable Code" as if they are mutually exclusive None of the options have to be mutually exclusive of each-other, that is simply how people choose to view it.
It is entirely possible to produce high-quality, maintainable, and well-performing code; you just have to foster the discipline to do so. Problem is, many of us, from the get-go, learn to do things the "it works" way, instead of the "it works well" way. For example, did your first Hello World! program use printf(...) or puts(...) ? Ask yourself, which one is the better choice -- which one works and which one works well?
As far as going back to older code, it has been a loooooong time since I went back to older code and thought: "what the hell was I doing here?" I have since created a heavily-commented coding style that leaves no doubt (to me or to others). Again, a good habit, like commenting, leads to better quality code overall.
Peace!
-=- James
Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"! Articles -- Products: Delete FXP Files & Check Favorites
|
|
|
|
|
Ralph Walden wrote:
But that gets right back to easily maintainable code. When you get to the phase that you are doing performance benchmarking and have isolated the areas where you need to concentrate on, then the "maintainable code" will pay off because it will be easier to modify.
Ditto for bug-free code. While that is certainly desirable, all complex code will have bugs. If those bugs aren't caught until after the product ships, then it could be months if not years from the time you wrote the code to the time you get a bug report on it and have to go back to fix it. If it isn't easily maintainable, then that becomes a headache, and you spend a disproportionate amount of time figuring out what on earth you were doing -- instead of quickly fixing the bug and getting back to writing easily maintainable fast bug-free code...
Spoken like a true veteran!
It takes a lot of experience to realize this simple
but universal truth!
|
|
|
|
|
diaphanein wrote:
This is a great point. Performance is a state of mind, a style almost. If you learn how to write code that is efficient, you can almost do it without thinking.
Yep! Practice does not make perfect, it makes habit. Practice doing the right things leads to a habit of doing things "the right way".
diaphanein wrote:
Just because we have fast hardware, doesn't mean the coder should use it as an excuse to be lazy and write poor code.
I could not agree more!
Peace!
-=- James
Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"! Articles -- Products: Delete FXP Files & Check Favorites
|
|
|
|
|
It is really a matter of concrete applications. If you develop software for internal use, buying better hardware can sometimes be more cost effective than investing into high-performant software.
On the other hand, if you are selling software on the market, performance is important.
|
|
|
|
|
Writing a resurce-efficient ofcourse. I mean what if you have a bugless code but there is no computer which has the resources to use that program then what good does your program do? Nothing.
|
|
|
|
|
Well, if no computer has the resources to run the program, how did the programmer test it?
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
You missed my point. No matter how bugless your program is there is no point if only a supercomputer is needed to run it. Like if we had pc:s like 200mhz pentiums and you shoud run the Longhorn in it. What is the point in it?
|
|
|
|
|
I don't understand what you are trying to say.
Mordok wrote:
Like if we had pc:s like 200mhz pentiums and you shoud run the Longhorn in it. What is the point in it?
Ummm.... I don't think a 500Mhz P2 could run Longhorn, let alone a 200Mhz Pentium.
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
It appears so. It was a symbolic language. The better code is the one that is simpler, less resource using if you compare two codes.
For example if you have a code that has few bugs but a memory usage of few megs and cpu usage only few percents. The other uses cpu 100% because dum desing and complexity but has no bugs. Whichone is better? You can use both but the other works better due to its simplicity, youknow the bugs always can be fixed and there is no such thin as bugless code if you do huge programs.
Another example. Let's assume that there is no bug's in Longhorn, but there are bugs in XP.
Like in this situation you sayed your self:
"Ummm.... I don't think a 500Mhz P2 could run Longhorn, let alone a 200Mhz Pentium."
XP uses less resources hence you can use these same resouces in somewhere else. Now if I use Longhorn and it takes all my resources to have it work what use it is for me? I can't do anything, although there in no bugs. But in XP I can.
I didn't assume that Longhorn would work in 200Mhz cpu.I don't assume it will work decently with my athlon either.
Do you see my point? First do it as simle and as efficient as you can. That it self remowes the bugs that comes from useless complexity. Then you have not as much bugs to fix.
Bugs are often revealed in testing, but you can't test it forever because your code doesn't then benefit anyone and you couldn't because you die in old age before it. Bugless program is a nice ideal but in large programs it's hard if not completely impossible to achieve. Then you'll come back to that resource efficient is a better thing.
ps. I HATE to write this long writings.
|
|
|
|
|
There is nearly no poll without at least one "CListCtrl"-vote.
Would you please be so nice to a clueless CP-newbie an tell me what's up with that CListCtrl... is it the visual implementation of 42, the answer to everything?
|
|
|
|
|
People often type search terms into the wrong boxes, including the one for text answers to a poll. Other people started noticing that, and somehow "CListCtrl" became representative of the mistake - maybe people were searching for it more than other terms. Anyway, it became a joke to type "CListCtrl" into the text answer for a poll.
Many people now think it isn't funny any more, but I suspect that CListCtrl has transcended "joke" status, and become a tradition. Traditions don't have to have a good reason, and can continue for ever more, because "it's always been done that way..."
Gavin Greig
"Haw, you're no deid," girned Charon. "Get aff ma boat or ah'll report ye."
Matthew Fitt - The Hoose O Haivers: The Twelve Trauchles O Heracles.
|
|
|
|
|
Damn! We could have told coco that the first one to enter "CListCtrl" into an unrelated poll wins a bob T-shirt. Or something like that!
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
|
As Gavin said, it's become a tradition. I've actually only used CListCtrl once, and it's a rotten control to program. But it's still nice, once in a while, to be the first to post it as an answer to a poll. Sadly, I missed the starting gate this time.
Some people think of it as a six-pack; I consider it more of a support group.
|
|
|
|
|
It was being accidentally put into the "Other" option for a couple surveys, and I thought this was funny, so I put it in a completely unrelated survey here[^]. After this is, nearly every survey for a couple months had a CListCtrl answer or something related.
Mwahahahaha!
Chris Richardson
|
|
|
|
|
I would endeavor to write code of free bugs.
Maxwell Chen
|
|
|
|
|
SET JUNKMODE = ON;
Code against the discrimination of little, colourful animals!
Freedom for bugs!
Come on, bug-fellows, my code belongs to you!
SET JUNKMODE = OFF;
|
|
|
|
|
Ok, i was checking the optional answers to see if CListCtrl made its way in and as expected, it's there.
<font=arial>Weiye Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
Well, perhaps that person writes GUIs, and they all require good-looking, well-functioning CListCtrl's to function properly.
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
Sometimes, it seems that CListCtrl has superseded 42
|
|
|
|
|
Navin wrote:
Well, perhaps that person writes GUIs, and they all require good-looking, well-functioning CListCtrl's to function properly.
Are you admitting that you are the one who enter this vote?
<font=arial>Weiye Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|