Find the answer to your Linux question:
Results 1 to 8 of 8
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Best Programming language to learn


    First, i know that there are no such thing as "The best programming language", but i want begin to learn my first programming language and i'm having trouble to find out wich language to begin.

    Most people will answer somenthing like "depends on what you want to program", but as i'm newbie in programming i have no idea of what i will program on the future.

    By searching on the internet i found out two language wich i'm interested, C(C++) and python, but i'm open to others languages too.

    From what i understand C is the most used language and also one the best languages to learn(?) since it's widely used and can be used to program several things. But i didn't understanded the real diference between C and C++. C++ is like C but with more resources from what i understand, so why learn C if C++ can do everything that C can do and more.

    I read that, the Linux Reader's elected Python as the "best programing language" but i have no idea of what i can do with python.

    Also i want a language that can be used on Windows and Linux (of course ;p) and i don't know if python can be used to create programs on windows and if it's possible can someone give me an exemple of a popular windows program write in python?

    Thanks in advance. (also sorry if there so many grammars errors, english is not my native language)

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA

    So first off, the difference between C and C++:

    C++ is fundamentally C, but it also is capable of something called object-oriented programming. This is basically a different philosophy of programming, where your data has behaviors. So instead of saying "Do something with this data", you say "Have this data do something". It also allows something called inheritance, where you could say "Do something with this animal", and be given either a dog or a cat, which are different pieces of data with similar behaviors.

    As a first language, I generally suggest higher-level programming languages, so in this case I would suggest Python. The reason for this is that you can learn about program flow and basic programming concepts without worrying about the syntax and complicated features (e.g. memory management) of a lower-level language.

    Any language that can be used on Linux can also be used on Windows (the inverse is not entirely true). Having said that, it is MUCH easier to program in Python (and in most languages) on Linux, just because of the way that executable files are handled on the two systems.

    If you don't understand any of this, please feel free to ask. Otherwise, good luck, and I will look forward to hearing about your journey.

  3. #3
    Thanks a lot Cabhan!

    Now i understand the diference between C and C++ (or at least one of them).
    But i didn't understand the concept of higher and lower level programming languages, is higher-level superior than lower-level?

    So i guess will start with Python, do you know a good website/book which teach that language?

  4. $spacer_open
  5. #4
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    West Yorks
    4,393 is a good place to start. The tutorial in the Documentation section is good for beginners.

  6. #5
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    High-level and low-level is not about what language is better. Instead, it's about what sorts of things the language does for you.

    For instance, when you program in C, you must manage the program's memory by yourself. You must explicitly convert the characters "1" and "0" into the number 10. It's also very simple to read raw data from some part of the computer, as opposed to converting it into characters (so reading video files, or input from a device of some sort).

    A major trend in languages is also for low-level languages to be compiled, while high-level languages are interpreted. A compiled language means that you write code, run a compiler, and get a "binary file". This file is not understandable by humans, and is written in machine language. You can then run this file on any system that understands the format and provides the libraries expected.

    An interpreted language, on the other hand, is a text file (human-understandable) that may be executed. At execution time, the interpreter (for instance, the Python interpreter) is run, and the program is fed into the interpreter. This means that there is no specific executable format for the program, and that any change to the program does not require a compilation step (you just run the new program). It does, however, mean that programs tend to run a bit more slowly (only noticeable for tasks that need to be very, very fast).

    Also, compiled languages produce a binary: you (in theory) cannot know for sure what language the program was written in. A binary may also be executed by anyone with a compatible system. Interpreted languages, on the other hand, require that anyone who wants to run your program have the interpreter installed.

    C, C++, and lots of older languages are all compiled languages. Most new languages are interpreted (e.g. Python, Perl, Ruby). Java is kind of a weird combination of both.

  7. #6
    C and C++ are relatively hard to learn for the beginning because you have to worry about system architectures and memory management yourself.
    Other completely object oriented languages such as Python or Ruby are IMHO also not a good place to start.
    I'd suggest using a simple procedural language to understand the principles of algorithms etc. When you know these you are able to choose the next language by your own.
    C is procedural, but it's not that easy for the beginning. Diverse BASIC dialects are much easier, but also language such as Pascal, Perl or PHP are good to start with (whereas Perl is more complex than PHP and Pascal is more like C, just with a completely different syntax).

    C, C++, and lots of older languages are all compiled languages. Most new languages are interpreted (e.g. Python, Perl, Ruby). Java is kind of a weird combination of both.
    Also Java is interpreted. I know, it uses JIT technology, but that's just an enhancement. Also languages like Python or .NET use this (but Python can also run as a normal interpreted script).
    You should also not distinguish languages by interpretation and compilation. Languages like PHP are definitely not native, but it's also not just interpreted as is. It's compiled into OP code first and than run in a VM environment. Therefore, you should rather divide the languages into native and non-native (run directly by the processor vs. run in a VM/interpreter or translated by a Jitter at runtime).

    Merry Christmas!
    Refining Linux Advent calendar: 24 Outstanding ZSH Gems

  8. #7
    Of course, there is such a "best" programming language which is assembly . You can do whatever you want with learning assembly programming. As an assembly style, stick to GAS for linux GNU OS. After learning assembly "well", you can enter to matrix world. which pill do you prefer .
    However, for "much" "faster" development language, I prefer C for library implementation, and C++ for application development
    see ya!

  9. #8
    Quote Originally Posted by Imada View Post

    First, i know that there are no such thing as "The best programming language", but i want begin to learn my first programming language and i'm having trouble to find out wich language to begin.

    Most people will answer something like "depends on what you want to program", but as i'm newbie in programming i have no idea of what i will program on the future.
    Fair enough. What do you want to do now, then? Personally, I find it's a lot easier to learn programming languages, applications, etc. if I have some other goal I'm working toward as part of the learning process... It helps give me some direction, and keeps the whole learning process from becoming too abstract.

    Personally I got started with C and C++, preceded by a little bit of Python (and, prior to that, childhood tinkering with Basic, etc.) As such, I feel like C and C++ are a fine place to start. Loads of software is written in C or C++ as well, so you'll have plenty of examples to work with.

    C++ can be very complicated if you get into things like templates, overloads, and so on... But C++ doesn't need to be complicated. Actually it can be a very simple option for starting out as it takes care of a lot of the memory management stuff for you.

    C and C++ are compiled languages which means that you must run a compiler to build an executable version of your code, as opposed to interpreted languages like Python, etc. where you can just edit your code and then run it. But the compilation process can be a good thing, too: C and C++ and similar languages do a lot of static error checking during compilation, which means you can catch a lot of common errors before you even run the code. More dynamic languages (Python, for instance) allow you a lot more flexibility with types, but sometimes this can be a case of "enough rope to hang yourself with". You don't have to formalize your types to the extent you would in C++, but the trade-off is that when something goes wrong, it can be harder to figure out why it went wrong. In C++ you may pass an object into a function, and then try to read some data out of the object and do something with it - if there's a type error there, if that field doesn't exist or if it's the wrong type for what you're trying to do, that'll be flagged during compilation. In Python, a bug like that could go undetected. You could run your program and not see the bug: the caller could pass anything for that argument, and Python has no way of knowing if a specific object is compatible with your function. You won't see the bug until it occurs, and possibly not even then. A bug like that could be harmless, or it could quietly do something wrong, or it could crash your program - possibly at a point far-removed from the place where you actually need to fix your code. So strong typing and compilation can be a bit of a drag but they can also be very helpful in terms of producing reliable, working code.

    That issue aside, I think Python is a very fun language to work with. I always thought of it as the programming equivalent of Legos: very versatile, very well-suited to tinkering, exploration, and experimentation, and a good set of "pieces" to build programs from. One of the advantages of a scripting language like Python, Ruby, or Perl is that they have substantial collections of libraries for doing things like talking to serial devices or putting a GUI on the screen, or dealing with different types of files. You can do all that stuff in C++ as well, naturally, but sometimes the scripting languages just make it a little bit easier.

    For instance, my first Python project was a script I wrote to interact with a USB-based PIC programmer. (I used that project as a motivator to teach myself Python.) Python has a nice, easy-to-use serial library. So I could write code to open a USB-serial device, like this:

    s = serial.Serial(portname, baudrate=19200, bytesize=8, parity='N'  ...
    Basically, I could express all those options in a very clear, easy-to-read way. Furthermore, this code would work on Linux, Windows, Mac OS X - any platform on which Python's serial library works. It would be fairly easy to write the equivalent C code on Linux, but the code would be uglier: and the code would not be portable. It would likely even be incompatible between different implementations of Unix.

    I would avoid PHP like the plague unless you specifically want to do web programming on a PHP-based site. To me it is a wholly unworthy language.

    Personally, I've always found it helpful to buy a book relevant to the language or library I'm trying to learn. Online documentation is very comprehensive, of course, and in some cases the paper books are little more than information culled from that online documentation - but to me it's useful to have a physical book I can flip through to find things... Examples of code similar to the things I'm trying to do, tutorials on how to use a particular feature, whatever.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts