frannyzooey-ee4meeAH724@public.gmane.org
2005-Feb-08 07:53 UTC
how to design rails application and TDD
Hi Every, Have your ever read http://wiki.rubyonrails.com/rails/show/HowtoDesignYourRailApplication ? My background is smalltalk. So unit test or test driven design is natural way to me. But now, I understand ''UI first'' is not bad for web development. Because It is more motivative. You can see what you want. I agree with a david heinemeier hansson, ''Interface is software''. Yes. Even thought I start with model or db table, It''s the minimum for ''working UI''. And more UI, more model. While I work with this pattern, I realize I don''t like test driven design. When I need to change model for UI, I want to change it right now. Not test first. If I don''t have UI code I need test driven. Because I can''t my model is right without UI. (unit test give me confidence and brave, my model code is not wrong.) But in ''more UI, more model'' approach, I can see how model works with UI. So I don''t want test driven. But I also worry about it become low quality. What I want to say is NOT I don''t need unit/functional test in rails but I don''t want test driven in ''more UI, more model''. Unit test is NOT same with test driven design. I can put unit test for my model latter. This is unit test but not test driven design. So I want to know your design pattern for rails app and how many people do test driven (or only unit/function test latter). Well, thanks for any advance. :)
Hi, I didn''t test rake yet but here are some general thoughts : Some people prefer to design the model first, some the UI, some the Tests. I don''t know if rake supports this, but JUnit for example has been extended for UI people. See http://junitour.sourceforge.net/ The goal is know the code coverage of your tests. This way you can build them as an after thought, to secure your code. Also it doesn''t give you the false idea that your code doesn''t have bugs, because your 3 tests has passed :p In general, I think, you should write tests where you encounter often code breakage. That way you can use UnitTesting as a development tool, but without having to cover every functionnality and get stuck with useless tests after refactoring. Coding well in not using a particular technique, but a balance between different ones ;) Cheers, zimba On Mon, 07 Feb 2005 23:53:11 -0800, frannyzooey-ee4meeAH724@public.gmane.org <frannyzooey-ee4meeAH724@public.gmane.org> wrote:> Hi Every, > > Have your ever read http://wiki.rubyonrails.com/rails/show/HowtoDesignYourRailApplication ? > > My background is smalltalk. > So unit test or test driven design is natural way to me. > > But now, I understand ''UI first'' is not bad for web development. > Because It is more motivative. You can see what you want. > I agree with a david heinemeier hansson, ''Interface is software''. Yes. > > Even thought I start with model or db table, It''s the minimum for ''working UI''. And more UI, more model. > > While I work with this pattern, I realize I don''t like test driven design. When I need to change model for UI, I want to change it right now. Not test first. > > If I don''t have UI code I need test driven. Because I can''t my model is right without UI. (unit test give me confidence and brave, my model code is not wrong.) > > But in ''more UI, more model'' approach, I can see how model works with UI. So I don''t want test driven. But I also worry about it become low quality. > > What I want to say is NOT I don''t need unit/functional test in rails but I don''t want test driven in ''more UI, more model''. Unit test is NOT same with test driven design. I can put unit test for my model latter. This is unit test but not test driven design. > > So I want to know your design pattern for rails app and how many people do test driven (or only unit/function test latter). > > Well, thanks for any advance. :) > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers, zimba http://zimba.oree.ch
* frannyzooey-ee4meeAH724@public.gmane.org <frannyzooey-ee4meeAH724@public.gmane.org> [0253 07:53]:> > But now, I understand ''UI first'' is not bad for web development. > Because It is more motivative. You can see what you want. > I agree with a david heinemeier hansson, ''Interface is software''. Yes. > > Even thought I start with model or db table, It''s the minimum for ''working UI''. And more UI, more model. > > While I work with this pattern, I realize I don''t like test driven design. > When I need to change model for UI, I want to change it right now. Not test first.Each to their own, but I didn''t find it that hard to stick a couple of unit tests for the model in before I added a new method. But then I''m keeping things as simple as I can, this is my first play with Rails. A lot of my tests just test basic activerecord methods, so I''m sure I understand them (which methods call a save, how often an ActiveRecord object checks with the database for changes and so on). I went for TDD on the model end mainly because I wasn''t sure where to start. I find TDD helps me document what I''m doing and gives me a small goal to work to, so I can add features in incrementally. That seems to be a plus point with MVC, trying to code up all three would have been too much to learn at once. Having said all that, I''m now starting on the controller and finding several of the ''features'' that are in the model would be better in the controller/view end of things. But that''s not a big deal, I can just code them there and refactor the model and its tests. So I''m more a ''more UI, less model'' in this case :) -- ''When you have to kill a man it costs nothing to be polite.'' -- Winston Churchill, On formal declarations of war Rasputin :: Jack of All Trades - Master of Nuns
> > But then I''m keeping things as simple as I can, this is my first play with Rails. > A lot of my tests just test basic activerecord methods, so I''m sure I understand them > (which methods call a save, how often an ActiveRecord object checks with the database for changes > and so on). >......> > Having said all that, I''m now starting on the controller and finding several of the ''features'' that > are in the model would be better in the controller/view end of things. > But that''s not a big deal, I can just code them there and refactor the model and its tests. >I would love to hear more about ''testing'' and ''refactoring''. All this emphasis on testing, and the associated terminology of ''unit testing'' are somewhat mysterious to me. Yes, I have beenn living under a rock somewhere half my life ;) Twitch
* James G. Stallings II <twitch-kuaf+BvAnvdypLqBFPtG/w@public.gmane.org> [0219 13:19]:> I would love to hear more about ''testing'' and ''refactoring''. All this > emphasis on testing, and the associated terminology of ''unit testing'' are > somewhat mysterious to me. > > Yes, I have beenn living under a rock somewhere half my life ;)I noly started doing it with ruby, it was too much of a pain with other languages. See http://del.icio.us/rasputnik/unit_testing for the links I''ve picked up. ''Testing in Reverse''.reverse in particular is a good intro. -- ''Everybody I know who is right always agrees with ME.'' -- Rev Lady Mal Rasputin :: Jack of All Trades - Master of Nuns