Cameron's Programming Tutorial #1 - What language should I choose?

Discussion in 'Plugins and Coding' started by repository, May 3, 2015.

  1. repository

    repository Member

    Messages:
    37
    Likes Received:
    127
    Trophy Points:
    33
    Hello everyone!

    I am very new to cubecraft (as seen by this being my first post!), but I would like to share some knowledge with those who are interested in development as I have been developing for 5 years now and have developed and worked on all kinds of interesting projects!

    The languages I will be covering are non-web development one's. If you really are passionate about web-development, then feel free to tell me to make another post about it some time.

    To start with I am going to give a brief overview of how computers process and execute information (see it's relevance later on).

    • Data in a computer is stored as binary (more technically known as machine code). Simply put, it's just 1's and 0's.
    • These bits (each binary value) are grouped into binary words; which are normally multiples of 8 - forming what's known as a byte.
    • This is where you get sizes from in files etc, (a KiloByte is 1024 bytes!).
    • Anyway, there are two essential parts that every computer has - a Main Memory and a Processor.
    • The Main Memory stores each binary word with a specific address.
    • The Processor is full of registers (small temporary holding storage points which all perform specific jobs). Together they will fetch-decode and execute the data.
    If you want to look into depth about this more search up the "Fetch-Execute cycle" in your preferred search engine - but you shouldn't need to know too much in depth!

    The different levels/tiers/generations of programming languages

    Generally speaking, there are 4 generations of programming languages.

    1st generation : The 1st generation is as simple as it gets. You are literally writing your program in binary.

    2nd generation: The 2nd generation is known as assembly code. It's written as commands which perform functions on certain addresses or values from addresses and can also be used to manipulate registers in the Processor.
    Example 1: LOAD #21 - would load the number 21 into a register called the accumulator (which just holds the most recent instruction) to be executed.
    Example 2: ADD 14 - adds the value from memory address 14 with the co-existing value found in the accumulator.

    3rd generation: The third generation is where the big differences come into play. Third generation languages are abstracted (simplified) way more than lower generations through named variables, Object-orientated programming, etc.

    4th generation: 4th generation programming languages are the highest tier. They are known as declarative languages whereas 3rd generation programming languages are imperative. In a 4th generation programming language you define WHAT needs to be done, and HOW you want to do it. Whereas in 3rd generation programming languages you only define WHAT needs to be done.

    Since these programming languages aren't in machine code (binary), how the hell does the computer run the program?!

    To transfer languages into machine code, system software called Translators are used.
    There are 3 types of translators :

    Assembler : This turns assembly code into machine code.
    Compiler : If a programming language uses a compiler, it means that the code needs to be compiled before it is run. A compiler links all of your source files and turns them into object code. This can then be turned into an executable file, which is composed of binary.
    Examples of languages that use a compiler : Java, C, C++, C#
    Interpreter : An interpreter reads the source code line by line and executes it on the go.
    Examples of languages that use an interpreter : Python, Ruby,

    Compiler vs Interpeter vs Assembler(very important):

    Compiled :
    • Produces executables.
    • Will run large programs very quickly.
    • The machine code isn't difficulty to understand, so it's easier to keep intellectual property.
    Interpreter :
    • Easier to debug - since the program is checked line-by-line.
    • Less likely to crash a computer - doesn't run directly on the CPU.
    • Uses less memory - source code only has to be present one line at a time in the memory.
    Assembler :
    • Useful for editing hardware (physical components of the computer) as you can change the values that they operate on in the main memory. BARE IN MIND: Other high-level languages such as C++ can do this too, but not on a very-specific level.

    It is essential you bare these factors in mind when choosing what language you want to uptake - ask yourself "What do I want to use it for?"

    Syntax of programming languages and What they do

    Unfortunately I cannot answer this as it would take wayyyy too long. They are all very different.
    What I would ask you to do is look at everything above and decide the purpose of why you are learning a language, THEN play around with it and get a feel for it and see if you enjoy it.

    ______________________________________________________________________

    You have reached the end of the tutorial.

    Thanks for reading. Hoped this helped! (Please tell me to expand on certain things if you want me to, and ask any questions if you want below).
     
    Younisco, _Patrickk, Spooks and 7 others like this.
  2. Accountrowan01

    Accountrowan01 Member

    Messages:
    354
    Likes Received:
    509
    Trophy Points:
    93
    Welcome to CCG!
     
  3. repository

    repository Member

    Messages:
    37
    Likes Received:
    127
    Trophy Points:
    33
    Thanks :)
     
  4. Yittamonkey

    Yittamonkey Member

    Messages:
    2,390
    Likes Received:
    2,371
    Trophy Points:
    113
    Welcome!
     
  5. repository

    repository Member

    Messages:
    37
    Likes Received:
    127
    Trophy Points:
    33
    Thanks!
     
  6. alyphen

    alyphen Member

    Messages:
    101
    Likes Received:
    99
    Trophy Points:
    28
    This is a decent summary of some of the basics of computing - let me know if you need any help, I've been programming for about 7 years now.
     
  7. Colourlight

    Colourlight Member

    Messages:
    2,157
    Likes Received:
    486
    Trophy Points:
    113
    Welcome!
     
  8. olsyboy

    olsyboy Member

    Messages:
    215
    Likes Received:
    57
    Trophy Points:
    28
    So what do you guys think is the best coding language?
    I reckon Java, C or Python :p
     
  9. GingerGeek

    GingerGeek Management
    Staff Member Management

    Messages:
    115
    Likes Received:
    607
    Trophy Points:
    128
    GingerGeek
    Management
    PLUS
    Completely depends on what you want to do lol
     
    Spooks likes this.
  10. olsyboy

    olsyboy Member

    Messages:
    215
    Likes Received:
    57
    Trophy Points:
    28
    @GingerGeek Does it? If you want to make GUI applications, you can use python.
    If you want to make a webpage, you can use python.
    If you want to make a database (it would be hard, but...) you can use python.

    If you are good then you can surely adapt a language!
     
  11. GingerGeek

    GingerGeek Management
    Staff Member Management

    Messages:
    115
    Likes Received:
    607
    Trophy Points:
    128
    GingerGeek
    Management
    PLUS
    Yes but it's to do with tools for the job. If you were writing performance centric code, you would use C or even assembler. If you wanted to work at a higher level of abstraction you could use Java, C++ or python. You can use any programming language to more or less do anything - but it probably won't work as well.

    Good luck reimplementing a SQL server in assembly ;0
     
  12. olsyboy

    olsyboy Member

    Messages:
    215
    Likes Received:
    57
    Trophy Points:
    28
    xD Funniest quote all day :p
    @GingerGeek
     
  13. olsyboy

    olsyboy Member

    Messages:
    215
    Likes Received:
    57
    Trophy Points:
    28
    But on a serious note yes I do completely agree with that, I am just saying that you can definitely adapt a language...
    Also, you can't build an Android app in Bash lol
     
  14. GingerGeek

    GingerGeek Management
    Staff Member Management

    Messages:
    115
    Likes Received:
    607
    Trophy Points:
    128
    GingerGeek
    Management
    PLUS
    I'm not saying you can't adapt the language, but there is definitely not a one-size-fits-all language like you were suggesting :)
     
  15. johnyestaloca

    johnyestaloca Member

    Messages:
    1,171
    Likes Received:
    2,127
    Trophy Points:
    113
    I use Google sometimes... Is that also good enough to join the club? :3
     
  16. olsyboy

    olsyboy Member

    Messages:
    215
    Likes Received:
    57
    Trophy Points:
    28
    .... Eek..
    Jk lol :p
     
  17. Younisco

    Younisco Sr. Mod
    Staff Member Sr. Moderator

    Messages:
    7,414
    Likes Received:
    11,920
    Trophy Points:
    549
    Younisco
    Sr. Mod
    PLUS
    Python is pretty good IMO, it's easy to use (kinda), and btw my brother made a database for a fitness place for signing up close to where we live, from Python.
     
  18. NanoNet

    NanoNet Member

    Messages:
    1,044
    Likes Received:
    347
    Trophy Points:
    83
    Python is good, but definitely not my favorite. It's very tedious with the compiler, because all the spacing has to be correct :( Languages (For example) like C++ and Java, their compilers ignore spacing and you can develop a coding style that way ;)
     
  19. olsyboy

    olsyboy Member

    Messages:
    215
    Likes Received:
    57
    Trophy Points:
    28
    @Younisco Yes, you could maybe read to some file or import a module to do it, but the language is not designed for that. At all.

    @NanoNet YAML is tedious?
    Just get an editor that does it for you xD
     
  20. NanoNet

    NanoNet Member

    Messages:
    1,044
    Likes Received:
    347
    Trophy Points:
    83
    I have JetBrains for Python. The reason that the compiler has to check for spacing issues is because there are no curly braces/containers for the code. I think instead of curly braces, they use ":". Personally I find it neater to have braces (And easier to de-bug), that's why I've adopted more of Java and C++ :p