a comment just before a function to explain what the function does, will always help decipher the code in the function. ( since function names are not intuitive to all, even if the name is to you )
Var NumberOfInvoices : Integer // The Number Of Invoices Procedure PrintInvoices; // This procedure prints the invoices Var lp : Integer; // LoopCounter Begin
//Loop though the list of invoices and print each one
For lp := 0 ToNumberOfInvoices - 1 Do InvoiceList[Index].Print; End;
Great eh, but this is all too often what people do when told to comment, comment, comment.
Drives me f'ing wild. Total complete utter waste of time, effort & resources and on top of that counter productive;
Comments should be restricted to why, they should be sectioned off somewhere relevant, but they should not break up the flow of the code, nor should they be so far to the right you have to scroll across to read them. If comments are required to understand what the code does then it isn't readable. They are useful on occasion though. An example I ran into yesterday
Procedure TMyObject.FreeResource; Override; ....
Procedure TMyObject.FreeResource; Begin //Stubbed out to avoid calling parent's method. End;
Great I can see that, why wouldn't you want to free the resource though ? Answer after some investigation on my part having looked at how the parent's methods had been overridden or hidden was the resource was never actually allocated and the stub was to simply avoid a warning of abstract methods in a created class message at compile time.
Now that in the comment would have saved me half an hour's investigation. Needless to say the comment has now been beefed up for when in six months time I or some other poor wally has to go near this code again.
Annotated code only helps if the annotation is helpful, the comment comment comment approach is for languages where there is a serious limitaion in the naming of entities. I' always consider comments in code in a modern language to be an indicator that I know I've written it poorly. There's nothing wrong with a bit of blurb at the top of the file describing what's in there though, any pre & post conditions, god forbid implicit dependancies etc.
You may for a while just want to read discussions and the TQ&A topics that interest you. You can learn a lot from the TQ&A. The discussion forums should be viewed with a sense of humor handy. There are a lot of opinions bandied about. The discussions can be a little bit emotional at times but fun all the same. The downloads sections have a lot of good checklists and summaries for all kinds of things related to computers and career.
To add on what S junkie said, this is surely the right place for you. Pls try to make the very best of verious section, and make sure you set your focus before logging on ( define your goal(S)). As well, try to ask as much question you can, and make the difference.
At a close, I wish you all the very best, WELCOME...WELCOME....WELCOME....
Being and MCSE/CCNP first and A coder second has come in extremely handy, I understand the fundementals of what professionals need and design all my apps to be centrally managed. I would highly recommend you spend some time in the real world managing a network, do the time you will get the knowledge to build great apps. if you build one good enough I will buy it!
First, Comment in your code, so people who come after you know how to fix it.
Second, Subroutine, Subroutine, Subroutine. I can not tell you how many times I have seen people re-do code over and over again when it would have been better to put in a call to a subroutine to take care of the problem.
Third, Make sure your programs clean up their trash. Every launch of an application makes a temporary file. Make sure when you hit the close button that it whacks the temp file before going south. I have seen XP systems crash because temp files don't get whacked.
Fourth, Don't re-invent the wheel. If you can get code from a free source, comment that the code is not yours, but theirs, then change it to fit your needs. Object-Oriented programming is just that, re-usable code.
Last, you will not write any code that has not already been written. So when you get stuck, ask!
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
New Member
I'm currently going for my Associates degree in programming. My instructor told us about this site and encouraged us to join.
Any help anyone could offer me by way of advice would be appreciated.
Thanks.