If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Learning to program?

(This is just my personal opinion so if you disagree, feel free to do so. Everything I say here is open for debate)

Learning to write your own programs isn't as easy as it looks. And for whatever reason, it's one of the first things any newbie is planning to do. Some even make very bold statements like: "Doom? I can rewrite that game with much better graphics and lots more speed in VB!" Of course, when you challenge these newbies, they already show the behaviour of real developers, saying they can't make it to the deadline and they need an additional week to get something finished.

I can still remember how I started programming. Then again, when I started programming I was already reasonable familiar with a computer. I knew how the OS worked (Windows 95) and I knew how to start and stop applications. And even better, I had a programming tool that made it real easy for me to write applications. I used Delphi back then.

Delphi is a so-called Rapid Application Development (RAD) tool. What it means is that it has some simple wizards to help you start a new project. It also has a socalled "form editor" that allows you to create simple forms in your application. My first lesson in Delphi was even a pretty complex one, which consisted of dropping a grid and a few other components on a form which would then give me an overview of some database table. I could build this application without writing a single line of code because the RAD environment allowed me to set all the settings needed for my program. Just imagine that. A newbie writing a database applicaton within 15 minutes. Not bad.

So, with the proper tools, the beginning of programming is relatively easy. And a proper toolkit is extremely valuable for people who want to start programming. However, all these tools will just allow you to do reasonable simple things and at one point you will have to start writing your own code. And that could be a bit of a problem.

So what's the best language to learn? Simple! Plain English, combined with a bit of math knowledge. If you have problems understanding the english language, you will have to improve that first, since almost all programming languages use English words all over the place. And once you have a good understanding of the English language, you can focus on the principles of programming.

Learning to program starts with understanding things like statements, loops, jumps and conditions. A statement is just a single command. A loop is used to repeat one or more statements. A jump is a way to step over one or more statements so those statements won't be executed. And a condition is just a way to decide which statement(s) the system will have to execute, depending on the outcome of the condition.

The easiest way to learn to program is by writing down (on paper) what you're doing every day. Just simply describe a simple thing like brushing your teeth, in very fine details. You'd start by getting your toothbrush. (statement) You then check if it is clean and if it's not (condition) you clean it. Then apply toothpaste (another statement) and start brushing your teeth from up and down, up and down until clean. (Loop with a condition to terminate the loop.) Of course, you could write this whole process down with a lot more details too.

The next thing to understand are procedures and functions. A function is just a special procedure that will return some value. (Others will say that a procedure is a function that does not return any value but that's just the chicken/egg discussion.) Procedures and functions are techniques that help you to combine multiple statements into a single statement. With the example above, you could say that "brushing your teeth" is a procedure because when you start this procedure, you're actually starting several other (minor) actions. And something like putting toothpaste on your brush is again a procedure. Or more like a function, though. There will either be toothpaste on your brush or the tube is empty and there's no or not enough toothpaste on it. So applying toothpaste would be something like getting the tube, squeezing it a bit and if no toothpaste comes out of it, you'll need a new tube. (And getting the new tube is again a new set of statements.

So what if you forget to write down "get a new tube if the current one is empty" in your toothbrushing manual? Well, then anyone who is strictly following your instructions will be at a complete loss. There is no toothpaste yet he must brush his teeth. Fortunately humans have common sense so they stop following your instructions. Computers, however, aren't that smart yet. Such a situation can either generate an error that the computer can handle but which probably will terminate your application. Or the system will just wait forever hoping that at one point toothpaste will magically appear in the empty tube. So this is what people generally call a bug.

When you're writing a program, there might be a lot of things that you will have to think about. If you forget to add something to your instructions (your code) then the system will get confused at some point. And you have to write code for everything you want the computer to do for you. Fortunately, many programming tools come with their own programming libraries. These libraries contain pre-made procedures and functions that you can use in your own code so you don't have to write them yourself. The use of libraries can make life quite easy, as long as you're using the right ones. (However, using the toilet brush library to brush your teeth might lead to some disgusting images and bad breath.)

So now you've learned a few basic programming principles for procedural programming. (Meaning, programming with procedures and functions.) Most programming languages support the use of procedures but there are a few exceptions. The MS-DOS batch files, for example, are just nothing more than a list of commands that are executed in some predefined order. Batch files also allow for conditions and jumps and thus it is a very primitive programming language. (And you can make a loop if you have a jump statement because you just jump back up a few statements.)

There is also something called functional programming which follows the same principles, but more mathematical. In functional programming, every statement is a function and the result of this function is used for the next statements. Basically, this kind of programming is extremely close to doing just mathematics. However, discussing this is a bit too complex to explain here.

However, things will become more complicated now. Ever heard of structured programming? Basically this is just a technique to make the code of a program more readable. With structured programming, you will have to see the "flow of your program". Is is popular because it's actually reducing the number of jumps that you have to write in your code. Or better, to write code without using any jumps yourself. It started with Edsger Dijkstra who actually advocated against the use of jumps in the socalled hgher-level languages. In these languages, the statement "GOTO" was used to make those jumps and in 1968 Dijkstra wrote an article called "Go To Statement Considered Harmful". Up until this day there are still people discussing if he's right or not, but it did start the new, structured way of programming.

Programming without jumps (GOTOs) means the programming language needs better techniques to skip some part of the code you write. The higher-level languages were thus created that they still do support GOTO, yet if you wrote your application well enough you would never need to use this command. It was a bit of an improvement because without these GOTO commands, applications became easier to read for the programmers. Nowadays, most people will advise you to not use GOTOs even though they don't fully grasp the reasoning behind it. (Well, Dijkstra said you shouldn't so don't!) But in the beginning it does get a bit tough to write code without this easy jump statement.

This already happened in 1968 and the programming world has involved a lot ever since. The next step was a pretty logical one. When you work with procedures, you often need to send data over with those procedures. And sometimes you need to send over a lot of information too. Of course, data was also structured in some useful ways. The 'invention' of records allowed programmers to group data together. And arrays made it possible to make lists of a single datatype. Yet a real link between proccedures was still missing...

So the next step was Object-Oriented programming. And with this technique data and code was linked together into one "object". Basically, you have some data and you have some procedures and functions that manipulate this data. To use it, you don't need to tell the procedure where to get the data that it relates to because it knows it's linked to the object. And the technique proved to be quite valuable, although not always a requirement. Many popular, modern languages are based on the object-oriented model. The whole .NET environment is just based upon objects, thus almost all .NET languages are object-oriented. The language C was also adjusted to support objects and it was transformed into C++, which basically means "C plus objects. Nowadays, the C language is seen as just a subset of the C++ language, but actually, it was the origin of C++.

Several other languages were also adjusted to support objects. The best-known of them is Pascal. The company Borland originally started with just a structural Pascal compiler until they created a Turbo Pascal compiler that supported objects in a bit limited way. They continued altering the language, improving it until they brought Borland Delphi on the market. Delphi is the name of the tool but it uses a language called Object Pascal. Delphi can be very educational for someone who wants to learn to program and who wants to learn every aspect of it. However, Borland isn't doing so well anymore ever since Microsoft started taking the compiler market with their latest Visual Studio versions and the .NET platform. When .NET came on the market for the first time, Microsoft already had their own compilers for this new environment and Borland was way behind in this development. Some people even think that the arrival of the .NET platform will mean the end of Delphi since Borland will always stay behind when new .NET technologies are developed.

So is object-oriented programming the latest technology? No, it isn't. But the newer technologies are a bit more difficult to recognise since they are all subsets of the object-oriented techniques. Things like component-based programming and of course .NET itself are making it a lot harder to come up with proper definitions for the latest technologies. Aspect-Oriented programming is one of those new techniques. IT has to do with how objects are interacting with one another. And it's a lot more complicated than just writing a few statements for brushing your teeth because you end up with a hand object, a brush object, about 28 to 32 teeth objects, a tube object and several other objects which each have their own methods to be used and they will all respond in some way making it all very interactive.

So if you still think that you want to learn to program, then keep in mind that you will have a lot to learn. Many people who learn to program get stuck at the procedural level with perhaps a bit of understanding of the more difficult techniques, yet they tend to think in a very straight line, going from statement to statement. Better-skilled programmers tend to divide a problem up in smaller pieces and will write code to deal with all those little pieces. (Dividing those pieces in even smaller pieces if needed. As a result, they end up with all kinds of little objects that are pretty interactive with one another. By linking them in a certain way, they get something to brush their teeth. If they use slightly different objects, they could build a similar program that brushes the floor. (Or the toilet.)

The biggest problem with learning to program isn't just learning some programming language. It isn't learning about how to use some library. The most important thing about programming is understanding the techniques you use. Basically, there are no good or bad programming languages anyway. Every language has it's own purpose, although many languages tend to be used for educational purposes. If you would look at a list of programming languages you would see why it's so difficult to make a good choice as your first programming language. There is just too much to choose from. But all programming languages are based upon the same principles. So if you know those principles, you should not have much trouble understanding most of these languages.

Btw, if you look at the list of programming languages, you will notice that not all of them are based upon the English language. There are a few that are based upon the French language and I think there's one based upon Jiddish. And as more countries start valuing their own language, it is quite likely that more non-english languages will be created. But even today, English is used for all the popular modern languages and many of the lesser-known ones.

Also, what if you want to make the jump from the basic monkey (programmer) to developer or architect?

Also, don't make the same mistake that most other noobs do...

C is a subset of C++ because C++ contains everything in C, not because of any order of precedence.

What you've written about it could be confusing to people new to the subject.

Finally what you've written about aspect oriented programming sounds alot like basic object oriented development and design. Could we get a clearer explanation?

"When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
"There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
"Mischief my ass, you are an unethical moron." - chshBlog of X

Copy Juridian, could use a some cleaning up and refinement, but this addresses a common question asked here -- "How do I start programming ?" -- and isn't covered in the tutorials as far as I can see. Delete, clean up (maybe submit it to one of the experienced programmers here, like Juridian ?), and re-post as a tutorial.

Originally posted here by hesperus Copy Juridian, could use a some cleaning up and refinement, but this addresses a common question asked here -- "How do I start programming ?" -- and isn't covered in the tutorials as far as I can see. Delete, clean up (maybe submit it to one of the experienced programmers here, like Juridian ?), and re-post as a tutorial.

Well, that's why I've posted it. It's an attempt to make some start of a programming tutorial and it could be refined a bit more. It's just a start. Please give more opinions and then this could become an interesting tutorial for people who want to start programming.

About aspect-oriented programming... It's new to me too and I can't say I know much about the topic. What I did do was add a few links to several Wiki's that are explaining things in a bit more details. Should there be more links to wiki's? Or less?

This is my first attempt at writing a tutorial, guys. So help me out a bit, okay?