Suzie wrote:
I've inherited some code from a developer who has moved onto other
things. The code makes up a rather simple application: a text editor.
The problem is, I'm still a novice programmer and I'm having trouble
accustoming myself to the programmer's coding style.
Could someone please take a look at the code and reformat it in the
way that the newbie books format code?
I ask because I feel it would only take a few moments for experts like
you guys, and it would do wonders for me.
Here is the code: http://www.Cotse.NET/users/jeffrelf/X.CPP
Wow! There's a different style violation on each line!!
This kind of code has no excuse. It reminds me of prima-donna code written
to "fit the most words into a character terminal". But that was before yours
or this guy's time.
Code must be readable by people first, compilers second.
If your boss thinks this code has any value, or that any extra time spent
working on it is your fault, you are screwed. Change your project or your
boss or something.
Any effort to reformat this code, or clean it up, will only throw good money
after bad. The code does so little, with such burden on everything it does,
that only a rewrite will make it better.
If you get clearance to fix the code, write what it does again, bit by bit,
into a new project. Make sure that project goes one feature at a time, and
test each feature (preferrably with automated tests) before pulling in the
next feature.
Use this code only as a cheat sheet, to show you things like how to call
SetPriorityClass() or RasEnumConnections().
Along the way, write the cleanest code you can, following rules such as
found in style guidelines like /Code Complete 2nd Ed/ by Steve McConnell.
And _frequently_ review your current progress and your code's state with
your boss and colleagues.
--
Phlip
http://industrialxp.org/community/bi...UserInterfaces