Sunday, April 7, 2013

Indentation

Djp just learned a new trick this past week: indentation. If you hit tab, djp-mode will act accordingly.

You can customize djp-mode to use spaces or tabs and it also indent line wraps. For example, the android code guidelines requires line wraps to be indented by 8 spaces and djp-mode will do the right thing:
Instrument i =
        someLongExpression(that, wouldNotFit, on, one, line);
There are a few pending bugs but I'm working on it :)

Sunday, March 24, 2013

Programming in Scala

I'm half way through the second edition of Programming in Scala. It's a good book and definitely recommended to anyone interested in Scala.

Martin Odersky took a pragmatic approach designing Scala. It's not a pure functional language, it's built on top of the jvm and it plays nice with java. Scala doesn't look alien to java programmers and yet it incorporates several common idioms from lisp, haskell and erlang.

I've also been writing a small project using the Play framework just to get the feel of it. It's still to early to say anything about the framework, but dang, it's a lot more fun than writing traditional java web services.

Monday, March 18, 2013

Djp is one year old

I can't believe that djp is one year old. Djp is a java parser / emacs-mode for java 7 that I've been working on my spare time.

The idea behind djp is to build an emacs mode for the java language using a java parser that provides a rich annotated parse tree that can be inspected and manipulated via emacs lisp.

The parser is based on the Java Language Specication - Java SE 7 Edition and I try to keep it as module that can reused by different projects.

The parser and the emacs output code are written in c++ and they account for approximately 12k lines of code.

The emacs mode is written in emacs lisp, of course, and it is heavily inspired by js2-mode. Currently, djp-mode is pretty simple and only provides syntax highlighting.

What's next? There are several features that I want to implement but the top priority right now is identation and a parser for binary .class files.

Sunday, March 10, 2013

The Making of Karateka

Karateka is the game that would lead Jordan Mechener towards the development of Prince of Persia. I've never played Karateka but I didn't think twice when Amazon suggested me the book The Making of Karateka: Journals 1982-1985. Yes, I know, I'm an easy target for Amazon.

The book has the same format of its follow up The Making of Prince of Persia and is equally fun, entertaining and inspiring.

Saturday, February 23, 2013

Final Fantasy XIII-2

I've always been a fan of the Final Fantasy series. I have fond memories of playing Final Fantasy I as a child. Back then most kids in my neighborhood had the Phantom System console, which was a clone of the 8 bit NES. The console was manufactured by Gradiente, now IGB EletrĂ´nica. That's the same company that registered the "iphone" name in Brazil.

Anyways, I was playing Final Fantasy XIII-2 this past year and one of the puzzles in the the game is a graph problem disguised as a clock puzzle which the game makes harder and harder every time the number of vertices is increased. I was not in the mood to grab pen and paper and try to solve the puzzle by trial and error. So, I fired up emacs and wrote a small script that takes the clock vertices as input and produces a Hamilton path as output. Here's the github link if you're stuck trying to solve the clock puzzle.

I've also bought the official guide of the game. Final Fantasy XIII-2: The Complete Official Guide - Collector's Edition. I'm pretty sure it would take me a lot longer to finish the game if it was not for a few tips included in this guide. It's also a good coffee table book.

As for the game itself, Final Fantasy XIII-2 is... ok. Not great, not terrible.

Saturday, February 16, 2013

Effective Java

I finished reading Effective Java from Joshua Bloch this past week. It's a classic title from the java land and that's the second book I read from Joshua Bloch. He's one of the authors of Java Concurrency in Practice.

Following the recipe of Effective C++ by Scott Meyers, Effective Java presents items that conveys one rule. There are 78 items divided into 10 categories: Creating and Destroying Objects, Methods Common to All Objects, Classes and Interfaces, Generics, Enums and Annotations, Methods, General Programming, Exceptions, Concurrency and Serialization.

What can I say? The second edition of the book was released in 2008 and if you haven't read it yet don't wait any longer.

Sunday, February 10, 2013

Postmortems from Game Developer

I've just finished reading Postmortems from Game Developer by Austin Grossman. The book is a compilation of 25 postmortems including top-selling games like Diablo II, Age of Empires, Unreal Tournament and Deus Ex.

The postmortems are divided into 5 different sections: Startups, Sequels and sophomore outings, Managing innovation, Building on a license and The online frontier. Each postmortem follows a basic format: Introduction, 5 things that went right, 5 things that went wrong and a conclusion.

The book is a joy to read but it's interesting to note that the vast majority of the games in this book fell behind schedule. What seems to be a common pattern in the software industry is the norm in the game industry. Scary.

Saturday, January 19, 2013

The Making of Prince of Persia

I finished reading The Making of Prince of Persia a few weeks ago and it's good! The book includes Jordan Mechners's journals from 1985 to 1993 and depicts the struggle of the author creating Prince of Persia for the Apple II while pursuing a screenwriter career in the movie industry.

I have fond memories of playing the PC version of Prince of Persia in the early 90's. The game is a masterpiece and reading the journals made me better understand why the game is so good. Jordan Mechner is not only an assembly programmer but a passionate artist with great attention to detail.

Highly recommended if you've ever played the game or if you're are involved in the game industry.

Thursday, September 20, 2012

Effective C++

I should not let this book go back to the shelf without a blog post
about it. I'm talking about Effective C++: 55 specific ways to improve
your programs and designs by Scott Meyers. I finished reading the 3rd
edition of the book a few days ago and felt guilty for not reading it
when it was first released. I know, right? This is a classic book and
old news for everyone else writing C++ code.

What else can be said? It's a great book! I only wish that the author
releases a 4th edition now that C++11 is out.

Friday, May 18, 2012

Java Concurrency in Practice

One more book to the java list. I recently finished reading Java Concurrency in Practice. I marked this book as high priority in my TO READ list a few weeks a go after observing intermittent deadlock problems in production code. It's not cool Butters.

Java Concurrency in Practice is a gentle introduction to the discipline of writing thread safe code. After reading this book I've been reevaluating algorithms, data structures and even simple design patterns like the singleton.

One interesting example is the nonblocking queue implementation in chapter 15. The algorithm is based on the paper written by Maged M. Michael Michael L. Scott and publicized in 1996! That's so... fresh.

Highly recommended.