Good Resources For Beginner Programmers

No mention of Pascal. I have been programming in Pascal for the last 25 years BUT it seems to coming to the End of Life phase so I would listen to przyk who seems rather more up-to-date than I am. However, Lazarus offers an absolutely superb cross-platform programming environment - with break-points - single step - pretty much anything you could possibly want - and it's free. I started off as a machine code programmer (8086, Z80,Z8, 6502, 6809) and I'm still stack orientated - call and return. 99% of my programming is still call and return with the compiler looking after the stack. Programming with the Lazarus 'Integrated Design Environment' is pretty much like shooting fish in a barrel.

To use PHP I think you'll need to install Apache (Probably LAMP or WAMP) - when it installs well it installs well and when it doesn't it doesn't - it's an IT (Information Technology) exercise in itself.

I've recently had a look at Python and the Open Source software for it. 'Hello World' comes out in a terminal simulation (which is maybe good) but I have to admit I haven't the faintest idea what I was actually doing to get that 'Hello World' in the terminal. Some_Beast_with_unknown_Power.'Hello World' - is not my idea of how to learn to program. I defer to przyk in this though. My Z8 assembler was written in 6502 machine code - I don't think people do that any more.
 
I don't think they're very good languages in general -- not just specifically for beginners. I think this is nicely summarised by the talk by Rob Pike I linked to. Basically, they're not very flexible or fun to use compared with the choice of programming languages available today, or even the programming languages that were available back in the 1980s and 1990s for that matter. (For example, two of the languages I mentioned in my previous post, Lisp and Smalltalk, are both older than C++. Smalltalk originated in the 1970s as an experiment in graphical, interactive, object-oriented development. The Lisp family of languages has a history going back to the second half of the 1950s, where it was first invented as an alternative notation and model of computation than the Turing machine.)

The issue is not (mainly) that I think these languages are too complicated or difficult for beginners*. If you're a beginner then you could probably start to learn to program in Java or C#, or maybe even C++ if you're dedicated enough, even with no prior programming experience. I just think you wouldn't be seeing the best examples of what a good programming language can do for you.

These languages (especially Java) also heavily emphasise (a certain style) of object-oriented programming very early. Object-oriented programming is useful for some things, but not for everything, and you could end up with a warped and imbalanced perspective on programming if you take these languages to represent the norm. I think it is also important to see how object-oriented programming is handled (often much more flexibly) in other languages.

There's a page by Peter Norvig where he gives good advice for people who want to learn programming at http://norvig.com/21-days.html. One good piece of advice (under "Language Choice") is to pick a language with an interactive mode, which isn't really supported with Java/C#/C++:


----------

*C++ is notoriously complicated and difficult to use (see the FQA I linked to for a good critique, or these interview critiques), but you won't see the worst of it until you start to learn the more advanced C++ features and try to use multiple features together in the same code: they have a tendency to not interact well and tread on each other's toes. So the complexity of C++ is actually a bigger problem for people who are not beginners: the more you know about C++ and the more you want to use its features together to express abstract and complex ideas, the more of a headache it becomes to make it all work safely and correctly.

Thanks for pointing out some of the negatives of Java, C#, and C++.
 
There are many programming languages that may be suitable for beginners, depending on your interests. For example, C requires a lot of attention to detail but could work as a first programming language if you have a certain kind of nuts-and-bolts mentality (basically, you could find C very interesting or tedious and boring, depending on what you find interesting). Or there may be a programming language that is obviously suitable for some specific kind of programming (e.g. Javascript if you're especially interested in running code in web browsers). Otherwise picking one of the high-level language like Python is a good place to start.

C is a procedural style language and Python is and object oriented style language, right? Is C hard and time consuming to learn and code with compared to other good languages out there, I believe C is a low level language? What makes Python better than other object oriented and high level languages?
 
C is a procedural style language and Python is and object oriented style language, right?

C is a procedural language. Python is a procedural language that also supports object-oriented and (to some extent) functional programming.

I wouldn't worry about this as a beginner though. First because there are more basic things to learn before OOP and second because OOP isn't all that well defined (different people define "OOP" to include or exclude slightly different things) and support for OOP in a language isn't a simple binary yes/no thing. For example, C isn't normally considered an object-oriented language, but it is still possible to use some OOP-style design and techniques in C. (It is fairly common to see this done in C where OOP fits the programming problem well, for example in C bindings for GUI/Windowing libraries.)


Is C hard and time consuming to learn and code with compared to other good languages out there, I believe C is a low level language?

C is a relatively low-level language. This means you need to deal with low-level issues manually in C that are taken care of automatically in higher-level languages.

The one that makes probably the biggest practical difference is memory management. In C, you need to manually ask the operating system for memory as you need it and you are responsible for manually freeing memory that you are no longer using. For nontrivial problems, this means you need to write code carefully calculating how much memory you will need and checking for when you need to ask for more. If you're not careful it is also possible to lose track of memory you've previously allocated or simply forget to free it when you're done with it. This results in a type of bug called a "memory leak". Many programming languages handle memory allocation and reclamation automatically.

"Hard to learn" and "hard to use" are different things. C is fairly compact and straightforward; it doesn't take very long to learn the whole language. But it can take much longer to write a complicated program in C than in other languages simply because you may need to do a lot of manual work (like the memory management just described) that higher-level languages save you from having to do yourself. Even if you use libraries that do a lot of the work, they still usually can't completely hide the low-level things going on.

The difference can be quite dramatic. For example, consider a simple math problem: write a function that computes the nth harmonic number, i.e., the sum $$1 + \frac{1}{2} + \frac{1}{3} + \dotsb + \frac{1}{n}$$. To make this a little more interesting, let's say the function should compute the result as an exact fraction, so it should find that $$1 + \frac{1}{2} + \frac{1}{3}$$ is exactly $$\frac{11}{6}$$ and not 1.833333.... If you do this in Lisp (a language with built-in rational arithmetic) then you're done in about ten seconds:
Code:
(defun harmonic (n)
  (loop for k from 1 upto n sum (/ k)))
In other languages you would typically need to look up a library for doing rational arithmetic and figure out how to use it. Python has one in its standard library that isn't hard to use. So the Python version, after a minute or two of Googling, looks like this:
Code:
from fractions import Fraction

def harmonic(n):
  return sum(Fraction(1, k) for k in range(1, n + 1))
For comparison, here's a C version using GMP (the GNU Multiple Precision library):
Code:
#include <gmp.h>

void harmonic(mpq_t result, long n)
{
    mpq_t reciprocal, tmp;

    mpq_init(result);
    mpq_init(reciprocal);
    mpq_init(tmp);

    for (long k = 1; k <= n; ++k) {
        mpq_set_si(reciprocal, 1, k);
        mpq_swap(tmp, result);
        mpq_add(result, tmp, reciprocal);
    }

    mpq_clear(reciprocal);
    mpq_clear(tmp);
}
This is typical of what C code starts to look like when you begin programming with nontrivial objects, even when a library is doing most of the work.

Having said this, I think C (as opposed to C++) is well worth learning at some point, for various reasons. Just have the good sense not to use it for problems it isn't very well suited for.


What makes Python better than other object oriented and high level languages?

Python is a popular high-level language with clear syntax and fairly regular semantics. This means it is usually easy to understand what a given bit of Python code is supposed to do once you have learned the language. (There are languages that have complicated grammar rules and/or are full of special cases treated differently than everything else. Python is generally not like this.) The "popular" bit translates to lots of tutorials and lots of useful libraries. Python is often recommended for beginners for these reasons but it is also used for "real" programming jobs. For example, the software updater on my computer is a program written in Python.

I would not say that Python is better than other languages. Just that it is a good language overall and one of the good places you could start to learn programming with. Python is not unique in this regard.

To give just one other example: you could consider Lua as a beginner language as an alternative to Python. Like Python, it is also fairly clear and high level and (from what I've seen of it) looks like it should be a nice, lightweight language to program in. I picked Lua specifically to mention here because you expressed an interest in game programming and one of the things Lua is known for is being embedded as a scripting language in game engines written in C and C++. So if you're interested in game programming, Lua could be one way to do that using an already existing game engine.
 
Last edited:
C is a relatively low-level language. This means you need to deal with low-level issues manually in C that are taken care of automatically in higher-level languages.

The one that makes probably the biggest practical difference is memory management. In C, you need to manually ask the operating system for memory as you need it and you are responsible for manually freeing memory that you are no longer using. For nontrivial problems, this means you need to write code carefully calculating how much memory you will need and checking for when you need to ask for more. If you're not careful it is also possible to lose track of memory you've previously allocated or simply forget to free it when you're done with it. This results in a type of bug called a "memory leak". Many programming languages handle memory allocation and reclamation automatically.

"Hard to learn" and "hard to use" are different things. C is fairly compact and straightforward; it doesn't take very long to learn the whole language. But it can take much longer to write a complicated program in C than in other languages simply because you may need to do a lot of manual work (like the memory management just described) that higher-level languages save you from having to do yourself. Even if you use libraries that do a lot of the work, they still usually can't completely hide the low-level things going on.

The difference can be quite dramatic. For example, consider a simple math problem: write a function that computes the nth harmonic number, i.e., the sum $$1 + \frac{1}{2} + \frac{1}{3} + \dotsb + \frac{1}{n}$$. To make this a little more interesting, let's say the function should compute the result as an exact fraction, so it should find that $$1 + \frac{1}{2} + \frac{1}{3}$$ is exactly $$\frac{11}{6}$$ and not 1.833333.... If you do this in Lisp (a language with built-in rational arithmetic) then you're done in about ten seconds:

Thanks! C seems interesting to me. I now understand C is a fairly low level language. I like that it a fairly compact and straightforward which makes it an easier language to learn. I now understand you need to manage memory with C, especially for big projects. It is also interesting what you can do with the math in C where a function can compute an exact fraction instead of just a decimal.
 
I started studying C recently and I like it. I think I will still study Java, C#, and C++ at different times in my free time because I like and understand all four of the languages so far.
 
If you find C interesting then I'd say go for it.

The classic introduction is the book The C Programming Language by Kernighan and Richie. One of the authors, Dennis Ritchie, is the guy who originally invented the C language.
 
If you find C interesting then I'd say go for it.

The classic introduction is the book The C Programming Language by Kernighan and Richie. One of the authors, Dennis Ritchie, is the guy who originally invented the C language.

Thanks for the book suggestion! I like C and I want to continue with it.
 
Are C and Python good computer languages for making computer games? Are there any resources available for doing this?
 
Or there may be a programming language that is obviously suitable for some specific kind of programming (e.g. Javascript if you're especially interested in running code in web browsers).

Can you recommend any good beginner level resources for JavaScript? Does JavaScript compare to C or Python in terms of difficulty?
 
Here is a link to Wikipedia that should answer your question:

https://en.wikipedia.org/wiki/Programmer

I think what Spidergoat was getting at is: how serious are you about learning programming in the long term? Being a programmer is not a simple binary thing, where you study a little bit and suddenly you're "a programmer" like any other. In particular, learning programming (generally) is not the same thing as learning to hack together some graphical stuff in Javascript (or whatever language) from tutorials.

Can you recommend any good beginner level resources for JavaScript?

I don't know Javascript so I can't give good recommendations on tutorials. Having said that, Javascript is one of the most used languages today. Google turns up a lot of tutorials for beginners.

Does JavaScript compare to C or Python in terms of difficulty?

From what I've seen of it, there isn't a big difference between Python and Javascript in terms of features or difficulty.

That said, I would avoid getting too carried away with language comparisons. All these languages are free, so it is fine to download and try out a few of them a little and see if you like one more than the others, but at some point you really want to start to learn programming with one of them. That means learning to solve programming problems and doing exercises and writing code on your own. A lot of this is relatively independent of language, so it doesn't matter all that much whether you start with C or Python or Javascript or whatever else. Pick one and learn it well and learn to do things with it, and don't worry if it isn't the "best" language for everything you might want to do.

In the longer term it is a very good idea to learn several programming languages (preferably several languages that are very different from each other for perspective), but this is for when you have a bit more experience. You have to start with something, so concentrate on learning programming using one language first.
 
Last edited:
A computer programmer is basically anybody who writes code as a profession, student, or hobby.
But there are ways to implement programs that don't involve typing out code. Even in coding there are libraries that don't require coding. What about node based visual scripting like grasshopper, is that programming? What about on-line apps that do a specific thing, am I a programmer by operating the app to produce a result?
 
But there are ways to implement programs that don't involve typing out code. Even in coding there are libraries that don't require coding. What about node based visual scripting like grasshopper, is that programming? What about on-line apps that do a specific thing, am I a programmer by operating the app to produce a result?

Those are interesting points. I am not a professional programmer or a programming student yet but I would consider computer programming to include any situation where you enter data and generate a result with that data. I do not think you have to create all the code that you use for processing your data into a result to be a programmer.
 
I think what Spidergoat was getting at is: how serious are you about learning programming in the long term? Being a programmer is not a simple binary thing, where you study a little bit and suddenly you're "a programmer" like any other. In particular, learning programming (generally) is not the same thing as learning to hack together some graphical stuff in Javascript (or whatever language) from tutorials.

I am beginning to become more serious about learning programming in the long term.
 
I did some research on JavaScript and I discovered it may be a good beginner language. JavaScript is a high level language which supports object oriented and procedural programming styles. JavaScript is a language run by most modern browsers and is most commonly used as a client side scripting language, which I think means JavaScript code is written inside a webpage and is sent to the users browser to be run when the website is opened. JavaScript is also used for server side programs and for mobile applications.
 
Last edited:
Back
Top