Tuesday, July 31, 2007

The (role playing) games we play

RPG games have been around for years now, and with the onset of computerized RPGs they have evolved beyond games once played by groups of spotty faced geeks. with the invention of the MMO world , RPGs are more popular today than ever in human history[1]! There are many elements that make RPGs fun, but i want to focus on one impotent aspect of the role playing world - the classes and levels system. when you play a role playing game you need to increase your experience to gain more power and magic. you have to learn to use your powers wisely if you are to progress. this crucial concept- experience-based power-wielding ability - is missing from the real world. especially in the software world.

I have been a programmer for a while now, and I've seen horrors coded in many languages. I've seen all kinds of dangerous 'language features' that should not be left unattended for the inexperienced programmer to abuse.
In the same way you will not let a ten year old operate heavy machinery while intoxicated(well, maybe for some harmless fun), you really shouldn't let computer science students use parameter overloading in c++ when they can barely comprehend the concept of functions.

This is why i think we should learn from the RPG world and implement a class and level system for the coding world. the details of such a system are presented here:

First you start apprenticing (Levels 1-3) and you are only allowed to use non languages like LOGO or HTML, after a while when you have proven yourself worthy, you might be allowed to progress to more advanced scripting
[2] (Levels 4-7).you can use java/vb scripting but only in a web based environment, where the browser prevents you from causing too much harm. once you gathered more experience (Level 8-10) you will be allowed to choose a VB programmer class. experts[3] agree that VB is not really a programming language, so anyone who chooses to use VB is forever forbidden from writing code in any other language.
Anyone who tries to code in Perl will lose all their execution privileges, not that it matters since it seems Perl programmers are more concerned with how many "kewl" things they can do in a single incomprehensible line of code, they wont actually notice that the code doesn't execute.

if you decide to program in a real language you will be allowed to select one of the real languages (c, c++, java, c#, assembly is reserved to levels 50+) each language will have it's own restrictions for a beginner.

C :
beginner c programmer can only use if, for, while, switch, single parameter function (you can choose between return param or function param), and 3 global variables (any more and the beginner gets confused). loops cannot be nested until level 13, you get a nesting level for each level above 13. altho, if you need beyond 3-4 nesting levels for anything you will be converted into a VB programmer. function within function calls have a limited stack of 3 calls. this effectively disables the beginner from using recursion, and also helps reduce their confusion with all these functions calling functions. the use of pointers is only allowed from level 15, void pointers from level 20, you get a new level of pointer nesting beyond the first for every level beyond 21, function pointers starting level 35, malloc is disabled until you reach level 30. you get 1 ifdef per level starting with level 12, programmers above level 20 can use as many as they like.
syntactic sugar like using ++ is only allowed from level 14 and on.
copy and paste functionality is disabled in the IDE until level 18 to prevent use of the poor man's code reusability (lazy programmers that cant refactor things into functions).

C++ :
all limitations for c also apply to c++, with extra limitation for operator overloading (level 50+). the required use of classes lowers the required level for use of pointers to level 10 (entry level for c++) but only class and primitive pointers. the use of function pointers is forbidden in c++ (object orient damn it!) until level 50+ those who practice the black art of function pointers and operator overloading will be periodically reviewed by the great council :the ICCC[4]. any transgressions will cause immediate demotion to either VB programmer or perl coder.

Java:
well, no malloc and pointers, so that makes life a little easier, also use of classes is enforced by the language, and no param overriding or ifdefs so you can do less harm to begin with.
the limitations for java programmers like function call stack size, loop nesting etc. is the same as in c++ and c. the catching of Exception is forbidden for programmers under level 23, RuntimeExceptions can only be caught by programmers level 26+. NullPointerException cannot be caught by anyone (except by catching more global exceptions) attempt to catch a NullPointerException will result in immediate demotion to VB programmer. the use of Vectors is allowed starting level 20 but allows only for storage of primitive wrappers and strings. When you reach level 25 you can choose other things, but you must take a test on garbage collection before you can advance to level 25. passing the test also allows the use of HashMaps. reflection can only be used from level 30+. the use of threads is allowed from level 40 and on, attempt to use the double lock pattern will result in a hearing before the great council which may result in a 3 week transfer to customer support. inheritance depth will be limited to 2 until level 15, you get an inheritance depth level for every level beyond 15. the use of anonymous classes is allowed starting level 18.
using JNI is allowed starting level 45 and requires knowledge of either c/c++ of at least level 20.

C# :
mostly the same as java, but with the reintroduction of pointers and limited operator overloading. unmanaged code + operator overloading require a level 50 c# programmer.
c#/java programmers get a bonus level in the other language for every 2 levels they get their native language.

You too can help improve the future of coding, coders, and software in general by joining the great council and adding new, more draconian restrictions on low level programmers (only level 40+ programmers are allowed to join (but not vote). you get one vote[5] per level starting with level 50). Join today by leaving your email address in any public website or forum and get free Viagra commercials, exciting business opportunities from Nigeria and more!




[1] - well, known human history, or rather ... human history that is known to me...which is a somewhat limited scope..but , well, it happened so long ago that no one* could seriously say they care about it..

*- no one except old people. it seems that at a certain age a lot of people start caring about history. i think it might be driven by their quest to prove everything was better in the good old days, and everything sucks now. then again, it could be that they are simply bored...

[2] - OS scripting not included. if you wanna write OS scripts you can change your class to Sysadmin, of course, you'll have to apprentice as annoying user, then progress to user, windows installer, super user, computer tech, and finally sysadmin. level 1 sysadmin can only maintain windows servers, only starting level 10 are you allowed to even see a linux/unix system. attempting to do so earlier can result in sever shock and sometimes death. the lack of a mouse based gui system has caused many inexperienced sysadmins to lose their minds and start clicking on random monitors. before the LCD days this often ended in electrocution .

[3] - an expert is anyone programming in any of the real languages (assembly, c, c++, java, c#)

[4] - - International Council of Computer Coders (take that, I triple E) - not associated with the other ICCC

[5] - The votes don't count

11 comments:

Anonymous said...

I'm glad you're not in charge of my CS education. Nobody should be taught in C or Java or Basic, they should be taught in pseudocode (aka Scheme). Only late in their programming classes should they be required to learn of the brain damage that is called C++.

Yossi Naar said...

i agree completely, no sense in troubling students who want learn computer programming with programming computers.

kozz said...

it seems Perl programmers are more concerned with how many "kewl" things they can do...

*hiss*

Perl has its place. It's a powerful language, but isn't for everybody. I guess you're just irritated because you don't know Perl and looking at it makes your head hurt?

Yossi Naar said...

sure, you can write good code in Perl, you can also write good code in other languages, unfortunately many don't.
When it comes to Perl, the ratio of good to incomprehensible one-liners is alot worse then it is in other languages. mostly because many Perl programmers seem to take pride in their write-only code.

Random832 said...

In C, ++ is "syntactic sugar" for what, exactly? I don't want to write (i=i+1,i-1) or (t=i,i=i+1,t) everywhere.

The only real syntactic sugar in C is [] and ->. a[b] === (*(a+b)) and a->b === (*a).b

And I've been informed LOGO is a real language. http://en.wikipedia.org/wiki/LOGO

By the way, your footnote reference links don't work - they link to the page you were editing from rather than being simple #name links.

Yossi Naar said...

1.it was ment in irony.

2.logo is not actually used to write applications, but more as an educational tool.

3.Thanks for letting me know about the links...i guess that's what happens when you copy/paste from office and don't check that it works on the page..oh well.

Anonymous said...

Sir, I'm not sure you are allowed to make blog posts like these - especially not as a level-1 blogger.

Sincerely yours,
A level-46 programmer.

Yossi Naar said...

:)

damn...i was hoping no one would notice...

thanks for knighting me btw :)

Boris Zakharin said...

I know this was meant as a joke, but here's the order I learned languages in:

QBASIC (on my own during high school)
C (on my own during high school)
Pascal (high school computers class, never used since)
VB Classic (on my own during high school)
ML (College, never used since)
C++ (on my own during college)
Java (College, never used since)
Assembly (College, never used since)
Access/VBA (First internship, never since then)
C# (Second internship, but I got to pick the language I wanted to use)
VB.NET (First job)

My current job is about 70% VB.NET and 30% C#. I'd like to think I'm an ok programmer despite this order.

Anonymous said...

OMG - you wrote this in 2007 an talk about using *Vector* in Java?!?

Back to apprentice level for not being aware of the collection framework and - more importantly - the necessity to code against generic interface types (List in this case)!

Vector is a badly conceived class left over from Java 1.0, and in the majority of cases, one of the non-threadsafe List implementations (like ArrayList) is what you want instead.

Yossi Naar said...

You would probably want to use on of the collections that support Generics.

Vector is still used in many places.
You can look at the following performance comparison as an example of Vector still being used.
http://www.javacodegeeks.com/2010/08/java-best-practices-vector-arraylist.html

Around the web Vector is still very much alive. It is true that these days it is far less common, but back in 2007 Vector was everywhere.