Pages

Saturday, September 23, 2006

Snakes and Rivers

Starting to learn about python, I've always hated python for as much as I've seen of it. I'm the kinda guy that likes C/C++, not because of the syntax and loaths Java because I feel it's to much typing. C/C++ has a very logical style imho. I'm used to stuff like this:

void someFunction(some, params)
{
      int somevar = 1;
      int comvar = 3;
      char anothervar = "something";
      if (somevar < comvar) {
            cout << anothervar;
      }
}
Python feels more like it'd be some thing like:
def someFunction(some, params):
      """About this function"""
      somevar = 1;
      comvar = 3;
      anothervar = "something";
      if somevar < comvar:
            printf anothervar

So far it's interesting, never really done much for Object Oriented Programming ether. Well inless you count reading allot of Java a long time back but never writting much.
While I can't remember why I got into programming, I remember I chose to start off with C++ because I knew it was common and I could find allot, also I found it interesting. Java I've read but not written, plenty of reading both about the language and the syntax but I've only written like a hello world app. The way I go by how much typing is involved is the Hello world program most tutorials start with. Example / Opinions:
/* ANSI C */

#include <stdio.h>

int main()
{
    printf("Hello, World!\n");
    return 0;
}

// My very first C++ program
#include <iostream>
using namespace std;

int main ()
{
    cout << "Hello World!";
    cin.get();
    return 0;
}

//Simple Hello World program in Java

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

#!/usr/bin/perl
use warnings;

print "Hello, world.\n";

#in python
print "Hello, World!"
As you can see, Python was the least involved to print one line of text to standard output. Perl wasn't so bad, like a shell script + I always use, use warnings with perl. Java doesn't look bad but 2,000 lines later I think my fingers would wear out. C++ is ok but a bit of prep work, C on the other hand is slightly less. While I reckon doing things in a language is always typing intensive up to a point, how much nitty-typing you need to do some thing short is the Q. Odds are in my book Java is probably better to learn first but C is easier to have to type out things. I must say I do like to hear of app's done in Java, I can even read it reasonably like a few other languages but I don't like to use it. I think I'm going to like Python, basically after I started with C++ I got board and switched to Perl learned enough to be able to grasp a few basics (and read it better) then got board. Whent back to C++ studies and started reading about Java. Got tired of C++ and didn't care for writting Java. Forgot allot of crap from no use, got back into it and tried to learn more about C. Fell inlove with it the second I saw this guide it's good for learning basic concepts and this guys got a nice sense of humor. I found it useful if not perfect but it did renew my interest in programming. Since then I've been playing with C and generally enjoying it.

No comments:

Post a Comment