Today was the first day of Devoxx, the European Java conference held in Antwerp.
The first two days are actually the ‘University’ sessions. These are longer, more in depth talks and the first one I went to was the ‘Productive Programmer’ by Neal Ford from Thoughtworks.
This was an interesting talk split into two sections, the first dealing with the mechanics of productivity and the second consisting of a number of tips putting these principals into practice.
The overarching theme was that “any time you are doing simple repetitive stuff on behalf of your computer it is laughing at you”. This means don’t type the same commands over and over but it also means learning keyboard shortcuts for your IDE and OS.
Neal demonstrated the Key Promoter plugin for IntelliJ which will pop up keyboard shortcuts whenever you use a menu item instead. I already use the GOTO class shortcut in IntelliJ all the time but didn’t know you can just type the capital letters of a class and it will find it. For example type ‘mac’ to find MyAwesomeClass.
Neal is so productive he doesn’t even bother to type the left hand side of statements in IntelliJ; he lets the IDE fill that in for him (using introduce variable). 🙂
Neal also talked about a concept called ‘locus of attention’ and the need to make your environment quiet to preserve your locus of attention. The higher the level of concentration, the denser the ideas, so turn off notifications, don’t keep email open all the time. Windows is the worst at stealing focus; “it is like a bored 3 year old”. Another reason why 80% of people here seem to have Macs… I quite like the idea of using something like Doodim to gradually dim everything on your desktop apart from the application you are working in.
The problem with using graphical tools to navigate a file system or class structure is that the hierarchies are too deep. Any time you know where you want to get to already it will be faster to search than to navigate. So make use of shortcuts like GOTO class or OSX menu item search.
Another neat idea was to use Selenium to record interactions for debugging web apps. Rather than having to repeatedly click through a sequence to get to where you need to be in the app, simply record the sequence using Selenium and play it back instantly. Even better: get your QA team to record a Selenium script to reproduce a bug and have them attach that to the JIRA ticket instead of a screenshot.
Neal suggests to always use a ‘real’ programming language for scripting (groovy, ruby, php) instead of sed or awk. This allows your little tools to grow into assets and lets you add unit tests and refactor.
The second major session was an introduction to MongoDB by Alvin Richards. This was a pretty in depth session and as he said it was a bit like drinking from the firehose but I came away liking what I saw.
MongoDB belongs to the so-called NoSQL family of data stores and is ‘document oriented’. Documents are stored as binary JSON and the schema is not fixed. This makes it really easy for your schema to evolve with your application.
With MongoDB you get all this built in:
- Horizontal scaling
- Simplified schema evolution
- Simplified deployment and operation
Reads can be scaled using replica sets. These are a cluster of servers where any node can be the primary and failover/recovery is handled automatically. All writes go to the primary node.
Writes can be scaled using automatic sharding. MongoDB’s sharding is transparent to the application code and migrations and rebalancing are handled automatically with no down-time(!)
You can either use the low-level java library to talk to MongoDB or use Morphia which provides a kind of O/R wrapper to map your POJOs. Morphia gives you Annotations like @Entity, @Transient, @Indexed, @PrePersist, @PreSave, @PostPersist, etc.
To backup MongoDB you can either use mongodump/mongorestore which gives you a binary dump that is not neccesarily consistent from start to finish or use fsync + lock from a slave and then snapshot the files.
It was a long day but a good start to the conference. Tomorrow I’m starting with another NoSQL data store: Cassandra.