Programming: Where to start?

Zeuz

Member
I've always wanted to be able to program anything I could, and I enjoy learning new things.

Any recommendations on where to start?
 
What kind of programming did you have in mind? Are there particular applications or environments that you find more interesting than others?

A lot of the concepts are similar but it's a different experience if you wanted to make web apps, executables, scripts, etc.
 
First learn programming languages
Learning C ++ is the foundation and the rest to other programming languages
 
I started with Java. I swear by it. This is what Java looks like...this just prints "Hello World!" to the screen and exits...

Code:
package com.spritemidr.myapp;

public class MainClass {
  public static void main (String [ ] args) {
    System.out.println ("Hello World!");
  }
}

C# is v. similar to Java, but it is aimed more at just Windows (unless you use something like Mono)

Code:
using System;

namespace MyApp
{
  public static class MainClass
  {
    public static void Main (string[] args)
    {
      Console.WriteLine ("Hello World!");
    }
  }
}

Python is decent. Python 3. I found at Uni that people who knew python when first learning had issues with the static variable system in Java. It is simpler, admittedly.

Code:
if __name__ == '__main__':
  print ('Hello World!')

Although for general stuff, you don't need the "if". All it does is makes sure it only runs if you run the script directly, rather than "include it" from another script. For our sake, we can just do:
Code:
  print ('Hello World!')

Python 3 and Python 2 have some big differences. This is PYTHON 3.

C and C++ are difficult for me to get going with, and I have been developing for a few years now, but are probably the most used. If you want a massive learning curve, but learn to program from the bottom up, more with how the processor deals with what you are coding, and how memory works... try them. C++ preferably. C is used to write the Linux Kernel. C++ can use C libraries, and is built over C, so it is more "usable" without having to write a load of stuff you dont care about when starting off...

C (should compile with C++ also, but it is good to replace stdio.h with cstdio and string.h with cstring)
Code:
#include <stdio.h>
#include <string.h>
int main ( )
{
  char msgbuff [20];
  strcpy (msgbuff, "Hello, World!\0");
  char *msgPtr;
  msgPtr = msgbuff;
  puts (msgPtr);
  return 0;
}
C doesn't have a "string" datatype you can use out of the box. You instead use an array of chars (a fixed length list of ascii characters). Since C doesnt know where the end of the text is, we end it with \0 (NULL). It will usually do this for you but if it doesnt for whatever reason then you will get memory issues. The program will keep reading from memory until it finds a null, which means you are potentially reading another programs memory, in which your OS will probably exclaim "Hell no" and kill your program...ending with a "Segmentation Fault" or Segfault or SIGSEGF. This will also happen in C++ but the string datatype (class, actually) is more flexible. In all other languages I have or will state, all of this is done for you automatically so you dont even have to know it exists.

C++ (wont work in C)...if you dont want to keep putting "std::" you can add "using namespace std;" on line 2...

Code:
#include <iostream>
#include <string>
int main ( )
{
  std::string msg = "Hello World!";
  std::cout << msg << std::endl;
  return 0;
}

I would say be wary of Javascript, as it can still vary from browser to browser. It is not as bad as it used to be though. It is pretty easy to pick up. Check out w3schools. Java script is more aimed for Website development...although it is slowly spreading out to non website applications...

On node.js
Code:
 console.log ("Hello World!");

On a web page, with HTML...prints Hello world when user clicks a button...
Code:
<!doctype html>
<html lang="en">
<head>
  <title>My Webpage </title>
  <meta charset="utf-8" />
  <script>
  function showMsg ( ) {
    alert ("Hello World!");
  };
  </script>
</head>
<body>
<h1>Hello! </h1>
<p>Click this button to see a message! </p>
<button onclick="showMsg ( )">Click Me! </button>
</body>
</html>

Excuse any mistakes, typed this on my phone.

Oh! People will disagree but I find Ruby to be good fun to learn with, as a scripting language similar to javascript and python
Code:
msg = "Hello World!"
puts msg

Ruby uses loops differently to other languages. In java, python, C, C++, JS, etc loops are similar to this (C#)
Code:
// print "Hello!" 10 times
for (int i = 1; i <= 10; i++)
{
  Console.WriteLine ("Hello!");
}

... whereas ruby is a bit more like human speech ...
Code:
# 'n' holds the number of the loop we are on
# ...e.g for the 3rd "Hello", n = 3
(1..10).each do | n |
  puts "Hello!"
end

The main thing is do research. Python is definately a start if you want to get going quickly...but if you can bear a bigger learning curve (variable types, mostly, as well as having to use object orientation more), go for Java. While C# is awesome, it has a lot more stuff to get confused with. This is a very crude explaination too...
Hm, gaming? If I could start with that I'd probably branch off into other things.
Gaming itself is complex. 3D and 2D games require a hell of a lot of maths if you do anything more complicated than flappy bird (even that has maths in it). You have graphics creation and usage, object interaction and collision detection, you tend to use matricies and vectors a lot. You have to make a 2D image from a 3D world to show the person playing the game if you do 3D games...like, how do you draw it..? Isometric perspective? Two point perspective?

Web site creation or Java console programs are a good place to start :)

If I may quote an XKCD comic:

standards.png
 
Last edited:
JavaScript is a client side thing though. Yes you can use node or <insert js server side library here> but why would you ever want to run a server application in javascript? *shudder*
 
JavaScript is a client side thing though. Yes you can use node or <insert js server side library here> but why would you ever want to run a server application in javascript? *shudder*

You can do cool stuff like:

Code:
console.log(Array(16).join("ECMAScript!!" - 1) + " Batman!");

...if that is an upside...
 
Back
Top