I’ve been working on a few new projects in my free time and have made a few discoveries. First of all - if you aren’t using Yeoman, you really should be. It takes a lot of the hassle out of building client side apps, Angular in particular, which is my framework of choice.
My other major discovery though, has to do with my approach to building rails apps. Rather than focus on the UI and web side of things first, I’ve been living and working in the /lib directory instead. Let me explain…
The process has been something like this…
- Figure out what core feature the app needs.
- Create a new class in /lib with a name like “CalculatePaymentsService”
- TDD the class’ features out.
- Run the class via rails/console to make sure the API/features make sense.
- Finally, start integrating with the rest of the Rails app.
This has been working out really well for the most part. By keeping things modular and isolated, it makes TDD actually fun. In keeping with a talk I saw recently, I’ve been sticking to values-in/values-out as much as possible, so mocking/stubbing gets kept to a minimum as well, which means more assurance that the tests actually work as intended.-