In this post I’ll talk a bit about the architecture of my first nodejs application, Battlefield 3 Web Commander. In addition to your usual web app stuff, Web Commander talks to Battlefield 3 game servers in real time and has many features related to that. It also displays data from the servers in real time. Because of these, there is …
Creating custom dojox.dtl filters
Dojo’s implementation of the Django Template Language (DTL) is pretty convenient for client-side templating in Dojo applications. However, sometimes you need to customize formatting of values, or add other custom logic to it. Using a filter for this purpose is quite convenient, but Dojo’s implementation is completely undocumented as to how you would add your own. Turns out it’s actually …
Why does everything need to be integrated into a framework?
There is occasionally people asking about things such as “Is there an integration for X in framework Y” Then they are disappointed when it isn’t, acting as if it’s a really bad thing. But why do things need to be integrated to begin with?
Thoughts on CoffeeScript
I initially dismissed CoffeeScript as just another silly attempt at making JavaScript not be JavaScript. It probably also compiled the code into some sort of totally wonky JavaScript, too. However, after thinking about it for a while, I decided to actually try CoffeeScript and see for myself. Now, after using it quite extensively on some projects, I feel I’m qualified …
Adventures in Haskell: Dynamic loading and compiling of modules
In my latest attempt at using Haskell, I was working on creating a kind of a plugin architecture for my application. I wanted to be able to load haskell code dynamically, without having to restart the main application. This is doable using the GHC compiler API’s. However, the documentation for it is quite lacking in examples, and while I was …
Doctrine 2 and the law of demeter
Doctrine 2 makes it very convenient to access related objects in your code: Just do a $entity->getRelatedSomething()->getThingValue(); However, this kind of pattern makes for easy errors when getRelatedSomething returns null – and as a side effect of this, you can end up with a lot of code which checks if the value exists before accessing it. This in turn can …
PHP typehinting gotcha in exceptions/methods
A small gotcha I recently ran into: If you use typehinting, PHP never checks that the class your typehint specifies actually exists! Read more for some examples
How to automatically run unit tests from a git push
Typically when working on code that has tests, you would want to make sure your tests pass when you share your code with other people. It’s generally a good idea to run the tests once in a while too, but why do it manually when you can automate? In this post I’ll show a simple shell script you can use …
Doctrine 2 adapter for Zend_Form model form generator
I recently updated the ZF modelform generator to include an adapter compatible with Doctrine 2. It’s otherwise completely functional, but it ignores many-to-many relations when generating forms (because I didn’t need this feature yet ;) ). Usage example after the jump.
You don’t need a service layer: Fat controllers are okay
Here’s a counterpoint to the currently popular view of “fat controllers are bad”, and the current fad of everyone and their cousin implementing service layers: You don’t need one. Fat controllers are okay too.