Posted in Uncategorized on 01/24/2010 10:05 am by Jenny
I love playing board games, so I was really excited to receive a copy of Rail Baron as a gift. Rail Baron is a classic game that has been out of print a long time and thus is a bit hard to find. It’s a long game which isn’t helped by the fact that there’s a huge chart in tiny writing which you use to find out how much money you make for going between two cities. This is the most unenjoyable part of the game. So of course I had to write a little script to automate it. This was also a great opportunity to do something useful with jQuery as I learn it. If you’re a jQuery user, I’d love some feedback on any beginner mistakes I’ve made.
Rail Baron payout finder
I found the data in an excel file here. Then I had to save it as a csv. Then I converted that to json. Then I did some manual clean up. It was a lot faster than typing it all in by hand though!
What next? I’d like to dabble with writing iPhone apps and this seems like a fun first app for that. The second least enjoyable aspect of playing the game is rolling for destinations. It would be fun to just shake the iPhone and it’ll choose a city for you and tell you how much money the route is worth. The players can just concentrate on the more enjoyable strategic parts of the game.
Posted in JavaScript on 01/23/2010 02:52 pm by Jenny
I spent yesterday playing around with jQuery. It’s quite different from Dojo and reminds me a lot of Prototype with a bigger community. I really like jQuery for doing DOM manipulation and find the terse syntax more appealing to write. I love the fact that it has a big community discussing, contributing, and helping each other learn. I do, however, have some concerns about how jQuery might scale up on a rich web application with a lot of functionality. The best way to find out for myself, of course, is to keep learning.
Extending the base functionality: big difference
Perhaps the biggest difference between Dojo and jQuery is the philosophy they took towards extending the base functionality. jQuery itself is best compared to Dojo base. If you want additional functionality, it’s available in user-created plugins which you download and include via script tag. In Dojo, you would find a module for this in dijit or dojox and include it with dojo.require.
Do you prefer extensions that have been planned out centrally to work together? Are you ok with having just one “official” way to do things with some configuration options? Would you rather just include the needed module and skip the process of searching for a plugin? Use Dojo.
Do you want to have the biggest number of options possible for the functionality you need? Don’t mind having to search around a little bit and compare plugins in exchange for finding one customized to exactly what you want? Use jQuery.
Dependency management
Dojo does really well here. There’s an “official way” to manage dependencies which is nicely supported by the library. You put your custom code in it’s own folder which becomes a namespace for your code. Create classes in separate files in the folder with dojo.declare and a dojo.provide statement. Just dojo.require them where you want to use them. The jQuery way is to… use the script tag? You can organize files containing the code however you want. I’ve only been using jQuery for a very short period of time, but I’d guess there are some “best practices” for organizing code that make this less of a problem when working with others.
Conclusion
The things that make Dojo great for writing complex applications are no help when trying to do simple enhancements. jQuery just makes these things incredibly easy. Just include the library, a plugin or two, and one file with your own code. I think in the future I may be using both depending on what sort of problem I need to solve.
Posted in Uncategorized on 01/14/2010 10:05 pm by Jenny
A rather belated Happy New Year! Perhaps I should make a belated resolution to update my blog more often? I took a long trip up north to visit the snow over the holidays. I came back to Atlanta for the coldest week we’ll probably have all year. I love cold weather, so I didn’t mind at all. Holiday recharge complete!
I’m looking forward to starting a new job at Geeknet working on Sourceforge soon. I’ll be shifting my JavaScript writing to jQuery and getting back to working with TurboGears on the back end. I’m going to miss everyone at LogicBlox and hope them the best.