Showing posts with label self.projects. Show all posts
Showing posts with label self.projects. Show all posts

9/3/08

Riding the camel - OCaml opinion (i)

I have started just a few weeks ago using OCaml. My only serious experience with a functional programming language was with Erlang, but I really liked it. I liked the shift of paradigm (although I am such an OO progammer (learned to program with Ruby), it was not difficult at all). Here are some of my thoughts about it.

Being a strong typed language for being functional at first sight seems cool. You can have all the benefits of typedness without actually the blot of the extra typing. Actually, it is, but it has its cons.

I really have nothing to complain (yet) about OCaml except for it's output libraries. I really miss my [puts | print | Console.Print | even the fugly System.out.println]. Debugging is a pain not as easy as another languages, just because of the printing. Not debugging itself, but unit testing, as part of test driven development (TDD), something relatively new to my and which I'm falling in love with.

I don't know whose fault it is, if the language itself for not being flexible with the types (at least the very basic ones) or the libraries. I know about some external libraries (MetaOCAML, Sexp, extlib) that try to handle this, but having to rely on external libraries leaves much to desire of the language.

The other thing I find annoying is that the compiler just points the first error it encounters. It's trivial for small files, but I'm scared of what can happen with larger files. Fortunately, TDD helps you not to commit those mistakes, at least not catastrophically.

Maybe the OO part of OCaml has it's advantages, and I want to think it has because pure functional programming in OCaml is not the way one would like, at least not me. But I have not explored that yet. My next goal: functors.

CC by shamiska

Well, all of this is because we are developing a Web framework on school, which had to be done in a functional language. It seemed like the perfect opportunity to learn another language, so I decided to give it a shot. I don't post the link of the project (although it's GPL3), because I don't know if I am able to do it given it is a school project, but once I can I would share the result with you.

6/21/08

RubyWeekend game contest - Yarr Blaargh!

Pirates vs. Zombies. That's the main theme of my game, and also the theme of the first RubyWeekend game contest.

It was an interesting contest in which there was only a slightly more than 48 hours to make a themed game. The platform and implementation was free, just it had to be written in Ruby. Among the options available (this presentation contains lots of options for making a game in Ruby) I picked Rubygame.

I have used Gosu before, which is a nice platform. But I wanted to give a try to Rubygame. Both libraries are very similar, maybe Gosu wraps in a little higher level events and sprite manipulation, but Rubygame is very flexible and efficient.

The game is called Yarr Blaargh. After all, what else would you expect to hear in a pirates vs. zombies battle? You can check the code here, altough in 48 hours I had not enough time to finish it, so you will see an incomplete project by now. Perhaps in the next weeks I can polish the details of the game.