Good Resources For Beginner Programmers

Discussion in 'Computer Science & Culture' started by mmatt9876, Dec 29, 2016.

  1. Confused2 Registered Senior Member

    Messages:
    609
    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.
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. mmatt9876 Registered Senior Member

    Messages:
    846
    Thanks for pointing out some of the negatives of Java, C#, and C++.
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. mmatt9876 Registered Senior Member

    Messages:
    846
    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?
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. przyk squishy Valued Senior Member

    Messages:
    3,203
    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.)


    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.


    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: May 16, 2017
    mmatt9876 and Confused2 like this.
  8. mmatt9876 Registered Senior Member

    Messages:
    846
    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.
     
  9. mmatt9876 Registered Senior Member

    Messages:
    846
    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.
     
  10. przyk squishy Valued Senior Member

    Messages:
    3,203
    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.
     
    mmatt9876 likes this.
  11. mmatt9876 Registered Senior Member

    Messages:
    846
    Thanks for the book suggestion! I like C and I want to continue with it.
     
  12. mmatt9876 Registered Senior Member

    Messages:
    846
    Are C and Python good computer languages for making computer games? Are there any resources available for doing this?
     
  13. spidergoat pubic diorama Valued Senior Member

    Messages:
    54,036
    Here's a question, what constitutes a programmer?
     
  14. mmatt9876 Registered Senior Member

    Messages:
    846
  15. mmatt9876 Registered Senior Member

    Messages:
    846
    A computer programmer is basically anybody who writes code as a profession, student, or hobby.
     
  16. mmatt9876 Registered Senior Member

    Messages:
    846
    Can you recommend any good beginner level resources for JavaScript? Does JavaScript compare to C or Python in terms of difficulty?
     
  17. przyk squishy Valued Senior Member

    Messages:
    3,203
    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 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.

    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: May 22, 2017
  18. spidergoat pubic diorama Valued Senior Member

    Messages:
    54,036
    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?
     
  19. mmatt9876 Registered Senior Member

    Messages:
    846
    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.
     
  20. mmatt9876 Registered Senior Member

    Messages:
    846
    I am beginning to become more serious about learning programming in the long term.
     
  21. mmatt9876 Registered Senior Member

    Messages:
    846
    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: May 25, 2017
  22. TheFrogger Banned Valued Senior Member

    Messages:
    2,175
    What about Exel (Microsoft office.) You can program macros using basic...
     
  23. mmatt9876 Registered Senior Member

    Messages:
    846
    Microsoft Excel is cool for inserting functions, working with data, and running calculations.
     

Share This Page