Fundamentals of Computer Programming
The 3 main processes of any computer program are Sequence, Selection and Iteration. I will describe these in full with the help of pseudo code examples. Pseudo code is a high level description of the program design which doesn't rely on any specific syntax and is intended to provide a logical overview without technical details. I will also provide some useful hints and tips which should help in the real world, particularly in the commercial environment.
Sequence
Begin program
Print "Hello World"
End program
Another version, which would work just as well as the one above, is this -
Begin Program
Call Subroutine PrintMessage
End Program
Subroutine PrintMessage
Print "Hello World"
End Subroutine
In this program there are two sections, a main body and something called a subroutine. In the main body, which in this pseudo code appears before the subroutine, the first and last lines are the same as in the first example and simply begin and end the program. The middle line of the main program calls the subroutine, a term which commonly refers to one or more lines of code which are grouped together in a program using a unique name, so in this example the subroutine is called PrintMessage.
Programming books on Amazon
Selection
Iteration
Hints and tips
Write your programs so other people can understand them
What this means is that in almost every case it is better to design a program so that it is clear and readable for easy modification by other developers than to sacrifice clarity and maintainability in order to optimise performance. Most of the time spent developing a program is done not at the initial development but in modification.
Unfortunately anyone who works as a professional developer sooner or later encounters code written by a show-off. Technically this person is usually very capable and their programs work well, but they may employ seldom-used commands or maybe they just apply their own brand of "logic" to create a solution. Sometimes it's done to optimise performance, other times it just because they've read about something new and they want to use it. It wouldn't be so bad if they used comments to explain what they were doing, but that would be too easy wouldn't it? Best of all, more often than not by the time you get to update the code the author has long since disappeared to pastures new.
So remember, someone else is going to have to update or fix your code so make sure they're going to be able to understand it. Put in plenty of comments, especially around the more complex areas of code.
Your feedback is appreciated!
-
Reply
- Astrieanna Astrieanna Jun 4, 2009 @ 3:39 pm
- I'd like to see the rest of this lens finished =)
I don't quite agree with your "Hints and Tips" -- programs should be written to perform at their best (since they'll be run more often than they are written). While you should include comments and well-named variables, good performance doesn't need to be sacrificed for simplicity.
I don't think of the fundamentals the way you've divided them, which makes your lens that much more interesting to me. =)
-
Reply
- Frank Frank Jan 22, 2009 @ 12:35 pm
- man... sit down tonight and write more i'll Apreciate it
-
Reply
- fefe fefe Jan 23, 2008 @ 12:37 am
- Looking forward to seeing the rest of your lens. Noticed you have some Head First Books listed, they are awesome. I am reading the Head First Javascript book now.
-
Reply
- ChrisGray ChrisGray Jan 17, 2008 @ 10:16 am
- This is really useful stuff for anyone starting out.
by crist
I'm 41 years old and live in West Yorkshire with my wife Nicky, daughter Zoe, son Daniel and dog Nefyn. I've been a software developer for 18 ye...
(more)
by 2 people |




