View RSS Feed

DarkLordoftheMonkeys

A brief review of the languages I've programmed in (in the order I learned them)

Rate this Entry
by , 01-26-2010 at 10:42 AM (509 Views)
TI-Basic: Hate it. Not because the language itself sucks but because of the editor it uses. Imagine vi, only without any features and perpetually in Replace mode.

Javascript: Between the time I started programming at 14 and the time I started programming again at 19 (after a 5.5 year hiatus), I wrote only one useful script or program, and it was in Javascript. I love JS because it is both simple, easy to use, and powerful at the same time. And you don't have to write 50+ lines of code to get something done.

Applescript: Man, I had fun with this one. I never did anything useful in it, though, just learned how to pop up windows. Some things I did with it: a text-based flight simulator, a text-based coin flip simulator, an evil quizmaster (with impossible questions like "What is the answer to this question"), and a script that creates a folder and makes it walk around the desktop. Don't remember any of it though.

C++: Hate it. If C is like vi, then C++ is like Emacs. If C is like Vim, then C++ is like, I don't know, TECO?

Java: Another language that I started off loving but ended up hating. My relationship with Java started to go downhill once I got to Swing. I also got a taste of Java's sheer power when I explored the Midi library, a massive collection of convoluted sound classes that all sound like cheap pianos.

Scratch: A good demonstration of the mind-boggling usefulness of graphical languages. You have a cat and you make it walk around and meow. I can't wait to build my new operating system with that.

SQL: I like SQL because it fills a niche. It's a database access language, which I find very useful, way better than, say, Access. I use MySQL, though I may be forced to switch to PostgeSQL or something if Oracle kills it.

DOS: Wrote a small test batch file once. That was about it. I only know 12 DOS commands: cd, dir, md, rd, edit, del, prn, type, cls, echo, netstat, and ftp, none of which are useful for batch programming (except echo and cls).

Vimscript: This is the default scripting language for Vim. I didn't learn much of the actual language, just the commands and how to put them in a script. I mostly just use it for my startup script. Still, I'm thinking I might want to learn it as a replacement for sed.

bash: This was a language that got me really erotically excited, for the sole reason that it ran completely in the command line. I love command lines.

sed: Also turned me on, for the same reason that shell scripting did. It's kind of difficult to do anything useful with it, though. I can use line addressing and the next, multiline next, quit, and branch commands to simulate flow control (closest to a while loop), but there are no variables. I'm thinking of learning Vimscript and using that instead.

Perl: I would've had a wonderful time with it if I wasn't being forced to learn it for my scripting class. Mostly, I just got tired of it, and decided to stick to bash, PHP, and sed. I might try to learn it independently sometime in the future, though.

C: The first time I was able to use pointers and create data structures successfully. I love this stuff, and I can't wait to learn more of it.

Stuff I want to learn in the future: lex and yacc, PHP, DOS batch, Fortran, Assembly, XLST (maybe), Vimscript, Common Lisp, and Prolog. Maybe Ruby and Python, just for fun.

Submit "A brief review of the languages I've programmed in (in the order I learned them)" to Digg Submit "A brief review of the languages I've programmed in (in the order I learned them)" to del.icio.us Submit "A brief review of the languages I've programmed in (in the order I learned them)" to StumbleUpon Submit "A brief review of the languages I've programmed in (in the order I learned them)" to Google

Tags: None Add / Edit Tags
Categories
Uncategorized

Comments

  1. ZekeDragon's Avatar
    It's extremely telling about the order in which you learned these. For you, C became a natural fit because it was imperative, and it emphasizes structural coding using functions, something Bash, sed, and awk don't emphasize nearly as much. Further, it's interesting to know that you had started earlier, noticeably prior to learning structured programming, trying to code using C++ and Java, which both very much emphasize OOP. I think I now understand a bit more, but also, I noticed something that you said.
    Quote Originally Posted by DarkLordoftheMonkeys
    And you don't have to write 50+ lines of code to get something done.
    On the contrary, higher level languages are designed precisely to perform the task of getting things done without writing 50+ lines of code to do it, and C is a notoriously verbose language when written properly. C was intended to be only one step up from Assembly, which is far from the dream of writing only a few lines of code to accomplish what you need to do. Consider this C program:
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    int load_file(char** addTo, FILE* file)
    {
        char buffer[80], *contents = NULL;
        int csize = 0, bsize = 0;
    
        while(fgets(buffer, 80, file))
        {
            /* We're just going to realloc contents as necessary to fill addTo
               with the whole file. */
            char* addpoint, *temp;
            csize += (bsize = strlen(buffer));
            temp = contents;
            contents = (char*) realloc(contents, csize + 1);
            addpoint = &contents[csize - bsize];
            if (!contents)
            {
                *addTo = temp; /* It can be deallocated outside the function */
                fprintf(stderr, "Reallocation of contents buffer failed.");
                return -1;
            }
            memcpy(addpoint, buffer, bsize + 1);
        }
        *addTo = contents;
    
        return 0;
    }
    
    int main(void)
    {
        FILE *f = fopen("test.c", "r");
        char *contents = NULL;
        if (load_file(&contents, f))
        {
            free(contents);
            return 1;
        }
        printf("%s\n", contents);
        return 0;
    }
    It's a simple C program that takes in the contents of a file and prints it out on the terminal. It's quite effective at this, and I am actually quite proud of that little function I devised since it is intended to load files completely and quite safely. It's also the smallest amount of source code I've been able to devise to perform such an operation, and I invite any other C programmers to attempt to improve it in safety and code size.

    However, I also wrote this to compare it to the C++ version. Take a look at how C++ would do it:
    Code:
    #include <iostream>
    #include <fstream>
    #include <string>
    
    int main()
    {
        using namespace std;
    
        string input;
        fstream f("test.cpp");
        if (!f.good()) return 1;
        getline(f, input, '\0');
        cout << input << endl;
        return 0;
    }
    This code will perform precisely the same task, and equally, if not moreso, safely. The function getline() is precisely the kind of function that allows for extremely simple, and safe, input. With the exception of having to deal with allocation issues (which is also the only problem the aforementioned C code would encounter), there's nothing that will really go wrong with getline (assuming you checked fstream::good() before that).

    Of course, perhaps in your case I would say you should learn Python. Seriously. Here's the Python equivalent of the above program:
    Code:
    print(open("test.py").read())
    Done.

    From what you've described as how you like languages, I think Python would be a good fit for you. Yes, it is more "English-like", but really I see no detriment to that, in fact it's a great boon, and Python can be quite fast.