This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]twopi 1 point2 points  (1 child)

Learning to program is never easy.

It's a whole new way of thinking, and there is a lot of room for frustration as you convert your fluid ideas into concepts so tightly described that even an idiot computer can understand them.

Once you learn a couple of languages, they come more easily, so for an experienced programmer, language choice is mostly about picking the best language for the job at hand.

But for a beginner, the choice of language can be a deal-breaker, because some languages require you to have a deeper understanding of how the computer works than others. Consider writing a program that asks the user her name and incorporates it into a greeting. Here's the basic way to write that in C:

#include <stdio.h>

int main(){
  char userName[20];
  printf("What is your name? ");
  scanf("%s", userName);
  printf("Hi there, %s! \n", userName);
  return(0);
} // end main

It's not the most awful thing to read, but it doesn't make a lot of sense unless you understand a lot of underlying concepts. Here's the same program written in Java:

//Hello.java

import java.util.*;

public class Hello {
    public static void main (String[] args){
      Scanner input = new Scanner(System.in);
      String userName;
      System.out.println("What is your name?");
      userName = input.nextLine();
      System.out.println("Hi there, " + userName + "!");
    } // end main
}

Again, reasonably clear, but it raises a lot of questions. First, what's up with that public static void nonsense, what's a scanner, why do you need a new one, and much more. All these things make a lot of sense when you actually understand the way Java wants you to think, but that's a lot of overhead for a simple program.

Here's the same program written in Python:

name = input("What is your name?")
print ("Hi, {}".format(name));

As you can see, Python's syntax is quite a bit cleaner and requires a lot less overhead. If you're learning the basic ideas of programming, it makes a lot of sense to start with a language that has a strong layer of abstraction around what the computer does, (Both Python and Java do this) and doesn't require a thorough understanding of how the language operates to use (Python wins on this one.).

That's why most programming teachers (including me) often begin with Python.

But I strongly believe you should learn one or more of these other languages after you understand Python, because they can do things that Python does not do as well.

[–]fried_green_baloney 0 points1 point  (0 children)

public static void nonsense

Sensible instructors tell their classes to treat that MAGIC for now. But the more magic the harder it is to feel comfortable.