This will give you a few hints and some help to becoming a
better programmer. So read on and enjoy! Programming can be a lot of fun if you follow these simple but efficient
rules to make it that way. Otherwise there are lot of programmers out there who
are unsatisfied with their programming skills.
So let’s get started..
Steps
[1].Gather complete requirements.Think about how what you write will
function; try to consider an efficient way of doing it.
[2]. Add Comments to your code.Whenever you feel your code needs some
explanation, drop some comments in. Each function should be preceded by 1-2
lines describing the arguments and what it returns. (Comments should tell you
why more often than what. Remember to update the comments when you update your
code!)
[3]. Use naming conventions for variables. It will help you keep
track of what type the variable is. e.g. for integer variables, intRowCounter; strings:strUserName. It doesn't matter what your naming convention is, but be sure
that it is consistent and that your variable names are descriptive. (See
Cautions and Warnings below)
[4]. Organize your code. Indent after each bracket, try putting
spaces between a variable name and an operator such as addition, subtraction,
multiplication, division, and even the equal sign (myVariable = 2 + 2).
[5]. Test.Try to think of anything that might prevent it from working
correctly. Debug the errors you find.
* Write your tests to always include the following:
o Extremes: zero and max for positive values, empty string, null for every parameter.
o Meaningless values: Jibberish. Even if you don't think someone with half a brain might input that, test your software against it.
o Wrong values: Zero in a parameter that will be used in a division, negative when positive is expected or a square root will be calculated. Something that is not a number when the input type is a string, and it will be parsed for numeric value.
* Write your tests to always include the following:
o Extremes: zero and max for positive values, empty string, null for every parameter.
o Meaningless values: Jibberish. Even if you don't think someone with half a brain might input that, test your software against it.
o Wrong values: Zero in a parameter that will be used in a division, negative when positive is expected or a square root will be calculated. Something that is not a number when the input type is a string, and it will be parsed for numeric value.
[6]. Practice. Practice. Practice.
[7]. Create a 'model' of your code that both the customers and the
final operators can understand - a blueprint. Present it to them so they
understand it and give them a chance to comment
[8]. Structure the project as a series of presentations and
deployments. Dont plan in too much detail beyond the 1st couple of
presesentations. Count on finding out new things about the brief every time you
present or deploy. Count on the customers and operators changing their minds
every time. Be ready for it. Use it. It will make the project actually worth
completing.
[9]. Build a simple program then after you get the program the way
you want it to be, then start adding new features to it. An example of this
would be to build a number guessing program where the program will generate a
random number every time you load the program then you have to guess the
number. Then you can add to this by having the program be able to have a new
random number with the press of a button, having you not being able to guess
after a certain number of failed guesses, etc. This will not only help you with
upgrading a program, this will also help you determine if there are any
problems with the program prior to the upgrade.
Tips n Tricks
- Start small, aim for things
that you most likely will be able to achieve, and work your way up.
- It is very important that you
use TAB spacing to differentiate lines of code that are encapsulated (if,
for, while, etc...) to make it easier to determine if you are still inside
the encapsulation. This makes it much easier to read.
- Tutorial sites are an excellent
resource as well.
- Reading the work of others
(source code) is an excellent means of improving ones skills.
- Use syntax-highlighting in your
editor, it really helps.
- People can often be a good
resource for information, particularly when starting out.
- Keep your past work, it is a
good point of reference.
- Change one thing at a time when
debugging and then test your corrections before moving on the next item.
- After each bigger segment of
work, take a break doing something else, then review what you have written
with a fresh mind; rethink and rewrite it, making it more effective and
elegant by using less code. Repeat until perfect.
- A program such as Visual Basic
.Net can cost a lot of money. If you MUST use visual basic, go out and
download Visual Studio Express Beta 2 2005 from www.microsoft.com or you
may buy the student or learning editions.
Remember programming languages like Java and Python, available at no cost. - Have fellow programmers read
your code. If you don't know any send your code to professionals. You
would be surprised what they know that you may have never thought of
before! Can't find a professional? There are plenty of forums on
www.myspace.com where most of the users are good hearted programmers that
offer constructive criticism.
- Double check spelling. A slight
mistake can cause a lot of stress.
- Use version control management.
Tools like CVS or SVN make it even easier to track code changes and bugs.
Once you get used to it you wont look back.
- Use an IDE (Integrated
Development Environment).
- Customers and bosses aren't
nearly concerned with how your program works nearly so much as they are
with how well it works. Think bottom line. Clients are intelligent, but
busy. They won't care what kind of data structures you're using, but they
will care if it speeds up performance by 10%.
CAUTION and WARNINGS !!!
- In step three, this Hungarian
notation (indicating a variable's type with its name) is widely avoided by
many programmers. It can easily lead to inconsistency when edited or
ported, and can become quite confusing. Try to avoid this as much as
possible
- Copying and pasting others'
code is a bad habit, especially if you weren't supposed to see the source.
But all things considered, taking small portions from an open source
program could be a learning experience. Just don't completely copy a
program and attempt to take credit for it.
- Save your work frequently as
you go along or you risk losing hours and hours of work to a computer
crash or lock-up.
- Always test your code
- Don't copy code from another
program unless you have permission or the license permits it, like Open
Source licenses.
Things You Will DEFINITELY Need
- Ideas
- IDE (Integrated Development
Environment)
- Computer
- Reference books or web
tutorials
0 comments :
Post a Comment