The previous installments cover roughly 4 hours of development, research and taking notes for these posts. That is 4 hours from doing the initial
rails notetagger
to having an application that works. It’s not perfect in any way, but it does most of what I initially aimed for. Not too shabby for a slowpoke like me, I say.
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Helpers | 20 | 12 | 0 | 1 | 0 | 10 |
| Controllers | 76 | 61 | 2 | 11 | 5 | 3 |
| APIs | 0 | 0 | 0 | 0 | 0 | 0 |
| Components | 0 | 0 | 0 | 0 | 0 | 0 |
| Functionals | 71 | 55 | 2 | 10 | 5 | 3 |
| Models | 17 | 14 | 2 | 1 | 0 | 12 |
| Units | 28 | 20 | 2 | 4 | 2 | 3 |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total | 212 | 162 | 8 | 27 | 3 | 4 |
+----------------------+-------+-------+---------+---------+-----+-------+
Code LOC: 87 Test LOC: 75 Code to Test Ratio: 1:0.9
There are still lot of things that can be improved on Notetagger.
One major thing that I haven’t touched at all is testing, and I reckon there are a fair few bugs and errors spread lightly around the code (for instance the application comes tumbling down if no tags are given).
Also the Ajax implementation could be better. The application is unusable if you happen to have Javascript turned off. Neither do the Ajax calls handle errors in a particularly good way.
I might cover some of the above in future installments, depending on how well the existing ones are received. For now I think I’ll relax a bit with making my Notetagger installation pretty and adding fancy Ajax effects that’ll make Flash designers weep with envy :P
Continue to next part: Adding users and subdomains
Why not to add
validates_presence_of :tag
to be sure the tag is always given (and it will automagically handle error message if there’s no tag) and to prevent “application’s coming tumbling down if no tags are given”? :)
It is that easy, and I just didn’t get around to it initially. However, I don’t want to force tags on all notes, so I’ll probably take a different approach.