MatthewMaynard.net Banner
Merry Christmas

[Previous entry: "Maxwell Horse Coffee"] [Main Index] [Next entry: "Merry Christmas"]

Links
Topics
Glossary
Archives
Contact
BOTW Scorecard

Powered By Greymatter

Current Homeland Security Alert Level

CPU Brain Candy

RSS 1.0 FEED

Hand over the cash and no bytes get hurt.

Site Meter

Listed on BlogShares

This page contains valid HTML 4.01 code.

12/23/2002 Entry: "The 4 Fundamentals of Computer Programming"
Posted by Maynard @ 03:44 PM MST

Blue Bar

Programming
The 4 Fundamentals of Computer Programming


With a new semester starting after the new year, it might be good to help out those poor students who have to suffer through the rigors and trials of a semester of an introductory programming class. To that end, I've summarized all the code you will write this next semester into four areas: decisions, loops, data structures, and functions. Click on.

These are the only four things you will write in code. Everything you do will be a combination of these four things.

Decisions are made with if-then-else statements, which check the value of a boolean statement. In the C language family (C, C++, C#, and Java) you also have a switch-case statement, which executes code based on an integer value.

Loops are also done with boolean conditions and integer checking. You use a for loop to repeat a task a certain number of times (the integer way of looping) and a while loop to perform a task when a boolean condition is true.

In every language you have basic variable types that store different types of data. These data types can be grouped to make more complex data types. This is called creating a new data structure. In object-oriented languages this is called a class or object. In function-based languages they are called structures.

Functions are also called subroutines and enclose a body of code that can be referred to by another body of code. Functions can be given one or more variables and can return a variable. You can also manipulate the variables you are given. Activating a function is the same as calling it. The variables you send it are sometimes called parameters and what it sends back is called the return value.

Object-Oriented Programming, a term you will almost certainly encounter in your class, is just the combination of data structures and functions to create more complex data structures. It also gives you the ability to simplify and compartmentalize your data structures. You can easily understand OOP if you think of it as putting your data structures into a family tree.

Hopefully that will clear things up at least a little for you.

Blue Bar

Replies: Comment on this post (1)

how do you write a program using computer programming to tell a person whether or not the number they entered is a prime number using while looping???

Posted by stephanie moore @ 03/31/2003 02:01 PM MST

Add A New Comment

Name

E-Mail (optional)

Homepage (optional)

Comments

Powered By Greymatter

This site is copyright 2001-2004 by Matthew Maynard. All rights reserved. All your trademarks, copyrights, insignia, and other distinguishing characteristics are belong to you. Sharks in suits make for good joke material. Don't leave a mess on your way out.

Links to external websites are valid at the time of article authoring and may decay as time goes by. But we'll always have Paris.

The opinions on this site are those of their author and do not represent anyone else's views. That is, unless and until you agree with them, at which point they become yours as well. Opinions expressed in the comments belong to the comment poster and may be edited for content. Play nice with others, since you want them to play nice with you.