Game Development Reference
In-Depth Information
programs use classes, and all classes require implementation duplication.
Therefore, the DRY principle is violated by the very heart of how C++ functions.
Both Java and C# were developed after C++ and both were heavily inspired by
C++ (copying a large amount of the syntax and features), but they both decided
to ditch header files.
You can be better than this; just remember the DRY principle.
If you'd like to know more about pragmatic programming, I recommend The
Pragmatic Programmer by Andrew Hunt and David Thomas. The details are in
Appendix A, ''Recommended Reading.''
Source Control
Source code is what you type into your editor when you're programming. When
source code is compiled, machine code is produced. The source code is for you,
the human, and machine code is for the computer. The computer uses the ma-
chine code to execute a program. Source control is a program that keeps track of
all the changes you make to your source code. (See Figure 3.1.)
Knowing how your code has changed and developed is not just really cool; it's
also useful. Source control gives you an unlimited numbers of ''undos.'' You can
keep going back to previous versions of the code if you make a mistake. This is
particularly useful when developing a new feature and you somehow manage to
break everything. Without source control, you'd be looking forward to a painful
process of trying to remember what you'd changed. With source control, you
can just compare your current version with the previous version and see im-
mediately what's changed, as can be seen in Figure 3.2.
You can also revert to the previous working version of the code and lose all the
broken code you added. Reverting is the process of replacing your current code
files with an earlier version of those files. It's like time travel! In the kitchen you
might decide you want to cut some carrots but accidentally remove your finger.
If humans had source control this would be no problem. You would just revert
to the version of yourself 15 minutes ago and your finger would be back.
Source control is also great for backup. It stores all your code in one placeā€”the
source repository. This might be a local directory on your machine (c:\source_
control) or it could be a server anywhere in the world accessible over the internet.
If your house burns down, your source code is still safe.
 
Search WWH ::




Custom Search