Advertisement

compile "addiction"

Started by May 24, 2002 05:56 PM
6 comments, last by jdawg2 22 years, 5 months ago
I just noticed that I like to compile my programs very frequently...sometimes after every couple lines. lol, is this normal? I''m still sort of a beginner, so I haven''t had any huge projects or anything (most complex program being pong), but I was just wondering if anyone else has this odd obsession with seeing "0 error(s), 0 warning(s)".
I''m not the only one? I feel so relieved.
Advertisement
This is sheer instinct, and the natural model of how many people like to program. However, it doesn''t go far enough. You should also test your program your program every time you compile. What!? Yup, I am saying to test your program every few lines. For this to be feasible, you need to learn how to write automated unit tests and to have the discipline to do so *before* you write the code that is about to be tested. When you can do this, you will trap problems very early, as you can know the bug is in what you''ve just written - the code is fresh in your mind and you can see what you did wrong. Fix the bug, recompile, retest. This means that you will spend less time in your debugger as your application evolves.

It''s fairly well known that a large percentage of a programmer''s time is spent in the debugger tracking down obscure bugs. If you can eliminate that time, you can write software faster and better. This is the smart way to develop. There are more techniques associated with this to help turn the economics of programming on their head. I don''t have time to explain all of the principles I''m hinting at, but here''s some search terms for you:

"test first programming"
"cppunit"
"refactoring"
"extreme programming"

Oh, and not forgetting... Agile Methodologies.

[ C++ FAQ Lite | ACCU | Boost | Python | Agile Manifesto! ]
i love it!
its gives me a smart feeling!
I am the smartest kid aaround!
YEAH!

_________________________________________________________________________
Can someone be nice and help me on my way to be the next Hideo Kojima? Thought So...
Hehe cool! Yea, I do exactly the same thing. I don''t write very complex programs, but I''ll compile after every few lines, mainly to see if it works at all Otherwise, I''ll end up with a page full of compiler errors, and they''re sooo much easier to track down when they''re only on a few lines. It might be overkill to compile big projects frequently, but if you''re just doing small projects, it''s probably a good idea.
Peon
Hehe... preaching XP in the beginners forum...
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Advertisement
I ctrl+f5 (compile+run) every few lines, even if I know it''s not going to compile. I just want to check syntax and whatnot.

Gamer-Insight.com
Well, I thought "why not". Trouble is, I don''t think what I said has registered.

For the newbies here - please don''t take what I''ve said as licence to write code in a seemingly random fashion. You''ve gotta be disciplined.. very very disciplined. What you are doing is fine for "programming in the small". When your programs start getting bigger, you need the techniques to support "programming in the large" and the discipline to rigorously apply those techniques. So, compiling every so often is no bad thing - it''s certainly better than writing a whole page of code before finding you have a syntax error. But don''t think that''s the be all and end all. Please do try searching the web for some of the keywords I mentioned and, most of all, study the information! Even if it doesn''t mean much now, keep the info in the back of your mind, and one day you might have an "aha!" moment.

[ C++ FAQ Lite | ACCU | Boost | Python | Agile Manifesto! ]

This topic is closed to new replies.

Advertisement