I'm currently staring in disbelief at the OnCreate of a form that's measuing 684 lines long.
I'm currently staring in disbelief at the OnCreate of a form that's measuing 684 lines long.
What... the...
This shouldn't be allowed. As in, the compiler should not accept this kind of crap.
What... the...
This shouldn't be allowed. As in, the compiler should not accept this kind of crap.
What would I give for something like StyleCop for Delphi...
ReplyDeleteNo, no. You are supposed to cram as much into a single procedure as you can - likewise the shorter the variable names the faster the code runs!
ReplyDelete>_<
Also reusing variables for unrelated purposes is good.
ReplyDeletePaul Foster LOL
ReplyDeleteKenneth Cochran LOL
And creating local variables that are used only once is also good.
ReplyDeleteUse goto as often as possible
ReplyDeletealways use only lowercase in code!
ReplyDeleteand no indents at all! f*ck the code formatiing! :)
ReplyDeleteAnd lots of nested WITHs - a joy to debug.
ReplyDeleteKevin McCoy Oooh...
ReplyDeletewith a, b, c do
Bill Meyer and short variable names are much faster to type, never use that boring long names :)
ReplyDeleteI think we've just described http://www.waterfall2006.com/gorman.html
ReplyDeleteDon't short variable names compile and run faster? Smaller EXE too.
ReplyDeleteHave to say, Delphi QA Metrics have such metrics like Lines of code in method.
ReplyDeleteWhy the hell someone would like to use variables? Just use const with {$J+}!
ReplyDeleteAnd if you have a small part of a unit which is used in more projects, dont extract it to a seperate unit and use it in both. You can use a lot of {$IFDEF ProjectA} and {$IFDEF ProjectB}! Your original code is untouched for compiler and you get only that part that you need!
Fabian S. Biehn Oh, I met one guy who follows your advice about compiler directives. I'm still trying to unsee that code.
ReplyDeleteSome excellent suggestions here. I'll make sure to mention them at the next team meeting, perhaps we can improve the code further...
ReplyDeleteRoman Yankovsky http://cantbeunseen.com/
ReplyDeletePaul Foster
ReplyDeleteactually I have run into a problem on some pc's where it turned out to be too long a procedure...the program would lock up..I had to split the procedure into small chunks..curious if anyone else has ever run into that problem...
Its an odd one, thats to be sure!
ReplyDeleteYou should also mix the business logic with states in the display logic, passing objects around using tag fields, etc. Preferably, you could actually keep all the values in the display object and do logic through there. Ensures that maintenance fees remain high. Don't forget to cast pointers to objects!
ReplyDeleteInline Assembler, Ladies and Gentlemen, Inline Assembler!
ReplyDeleteCram as much as possible into a single routine instead of splitting it into logical pieces(Pros , might consider writing their whole program in a single Inline-ASM Block, only valid with more than 1000 lines). Comments are for beginners and keep in mind to write only for one specific CPU type. The world doesn't need more than one.
Oh, and when you comment, make sure you comment the how's of each statement as they are seen, and not the higher purpose of the statements and why you do what you do.
ReplyDeleteExample: Good commeting
if Check(value, limit ) // compare value
then Accept (value) // keep value
else Discard(value); // don't keep value
Example: Bad commeting
// Only save values that have been validated
if Check(value, limit )
then Accept (value)
else Discard(value);
Try.. Except the whole code to ensure your customer shall not see any errors, even that thing not work.
ReplyDeleteTry..Except? Really? The Source you write as a total pro is so flawless, you don't even need try...finally
ReplyDeleteIf something pops up->customsers fault.
Confuse your user in confirmation dialogs.
ReplyDelete"By cancelling, you can avoid this problem. Do you want to avoid?"
[Yes] [No] [Cancel]
Seen it, and worse. I recall a message like: Do you not want to not cancel dropping this null insertion?
ReplyDeletesuddenly realised you guys were all taking the mickey :)
ReplyDelete