Monday, July 14, 2008

Version 2.0 now in Java

I’m slowly working on MTG Forge version 2. First I started version 2 in Java, then switched to Python because it seemed so cool, but now I’ve switched back to Java. Python is very, very cool but I keep thinking “in Java”, so one night I got frustrated and said to myself, just change back to Java.

For version 2.0 I knew that I wanted a better user interface, but I wasn’t sure how to draw simple graphics with Java. I switched to Python because I saw a very good user interface written with it. But learning a new language from scratch and trying to program a large program with it at the same time is a little bit futile. It is like me saying, “Why don’t I write a novel in Spanish.” I could write a novel in Spanish but it would much easier if I just wrote in English, a language I already know.

You, the user, won’t notice any differences between Java or Python. Most people just want something that is easy to use, which usually means having an attractive user interface. If you have used other free software, games or otherwise, you will probably notice that most of the time their user interface is a bit lacking and hard to use. As I have said before, writing a good user interface takes a ton of time and effort.

Most of the time one person, or group, will write the user interface and another person, or group, will write the rules engine. A programmer who is good with both the front end, the user interface, and the back end, the engine, is rare. As you might have noticed, most programmers and geeks have a hard enough time dressing themselves so writing a good user interface is pretty much out of the question.

Having a good-looking user interface is like a car with a nice, shiny paint job. The paint job has nothing to do with how the car runs, but it sure does help.


Anonymous said...

You are right about sticking with the language/tool you are familiar with.

But I am to understand that you have trouble dressing yourself?
Dude, that is a total "too much info" overflow error of the visual kind!
LOL! Sorry, mondaymorning and all that. ;-)

rising fruition said...

I had noticed a decrease in Python posts... And it's too bad, at least for me. I want to find a way to be more productive as a programmer. I was considering learning a new language like LISP, Scheme, Ruby, or Python. Dynamically typed languages. I've heard amazing productivity claims. I was looking forward to learning from your Python code. :^(

But, it's hard to jump to a new language cuz many things that are simple in your current language are things you have to learn again in the new language. And that takes time. And energy.

Have you looked into Jython? Supposedly, since I haven't tried this stuff, you can call Java from Python and Python from Java. If that's true, it might give you a way to write useful Python code for MTG Forge while still letting you code in Java at full speed.

Regardless, good job with the game. It's a big project!

Nanocore said...

I was a supporter of the python rewrite, but I do understand that need to go with what you know. However, one of my reasons for the python rewrite was I was looking to port it to my tablet and java doesn't run on it. Not that it matters to anyone, but coincidently my need to run it on a tablet went away as I have the new iPhone. So, now I want to put this on my new device as I won't be carrying the tablet anymore. Hmm, anyone know of a Java to Objective-C converter? Guess I will just have to port it by hand... Keep up the good work though!

DCelso said...

I still think that you must do a MMORPG like game. It only consist in an app server with a states machine that can receive the events in an user defined protocol, like:
draw a card, play an litiing bolt, etc. the server only was an intermediate bettewen two clients connections.(You can do more connetions like vieweres or administrators).
And the client will be in Java or pyton, only need know the port of server and the protocol to send a request the events for draw the desk.

DCelso said...

why Spanish? Are you Spanish?

Forge said...

Hi everyone,

As for dressing myself. I have a collection of blue and black shirts and pants that I choose from. (I can't go wrong with that sort of dress code.)

"Why Spanish? Are you Spanish?"

I just picked a language I don't know. Just like I don't know French either, lol.

About Python, learning a new computer language is like learning a new culture. They do things differently, they have different values. Learning the culture or the "common practices" of a language is just as hard as the language itself.

I loved the small amount of time I spent with Python. I wrote about 50K of code with it and lists are truely a thing of beauty. If you want to learn Python, I'm sure there is lots of good Python code out there.

And the biggest hurdle about Python is the IDE. Having a super, great IDE is half the battle. And knowing your IDE in and out is about one-third of the battle.

Jython sounds OK but using the Java libraries in Python is still hard to do. Somehow Jython can compile Python into put Java class, but you have to jump through some hoops.

If I had a Python programmer sitting next to me that I could ask all these random questions, I would probably stick to Python. But when I'm programming at 2am and I have a problem, I need to know how to figure out the answer now without the Internet. So for now, Java is my goto language.

Forge said...

I'll point out one super technical programmer thing I liked about Python. In Python you could declare simple classes with just public variables, no methods were needed. And if in the future you wanted to convert a public variable into a method, you could do that to.

In Java public variables are considered bad because they can never be converted into methods in the future. So in Java you have a ton of get and set methods that "wrap" every variable.

The value of a computer language that lets you convert variables into methods is very useful and I think C# (which looks a lot like Java) also supports this.

Gando the Wandering Fool said...

I have to say stick with what you know if it gets the job done.

RE: UI programming ...I do not consider that at all window dressing. If you consider your program purely from the point of view of the end user, a clear usuable interface makes a huge difference in learning curve and interest. Similarly adding a handicapped ramp makes getting into a restaurant more likely for those who have difficulty periambulating.

I've never written anything in Java so I can't speak on the ease or difficulty of making usable interfaces in it except from my own experience as an end user. Ive noticed that most java programs tend to have a clumsy look/feel and seem very disorganized. By that standard MTG Forge is way ahead.

RE being able to be flexable in programming is a big plus: I'd say you do not really want to mix data with proceedure which is probably the reason Java doesn't support that currently. Though wrappers do seem an awkward compromise.

Im more used to javascript oop which is loosely based on C/C++ though it claims Java ancestry.

Being able to do this

var someObject = new Object();
someObject.someDataString = "blah blah";
someObject.someMethod = new Function(){//dosomething here with the data and return}

is nice and isn't something I've seen directly in other languages.

C/C++/C# classes do the samething functionally but the typing is very different (someObject.someDataString could be any data type in js...but in the C family would need to be a string) and the rules for private/public/protected/static/global etc are very different.

All this to say I sympathize and wish it were all more standardized...but then wed have one language and would need to know everything all at once. :D

Silly Freak said...

I think the eclipse IDE is phantastic. It has features to convert attribute access to getter/setter access for a whole project, including generating the methods. So, if the lazyness of writing those extra lines is a minus for java in your eyes, it's not that bad.

eclipse also assists you with many other things, unfortunately not with designing GUI. However, I kind of like coding GUI by hand, so it hasn't ever mattered to me.

the type-strictness of java is one thing why I like it. If I have a variable, I want to know what I can do with it. I don't have much experience with other OO languages, but the code I wrote in java looked way cleaner and better understandable than in any other language I tried.