occasionally useful ruby, ubuntu, etc

19Jul/090

Design pattern/flow for building a website

So here's how I normally do things:

  1. Do as much of the models as possible in this first pass, skipping validation but including schema stuff
  2. Stick a couple things into the controllers that I think I'll need
  3. Build out some of the views, giving them some basic styles
  4. Revisit the models to add validation, helper methods
  5. Build out the rest of the views, give them real styles
  6. Muse about specs, then give up before starting
  7. Put more stuff into the controllers
  8. Iterate on random components until you're done

Needless to say, I'm getting to the point where my lack of organization kills my mini-projects before I hit step 4, sometimes even sooner than that.  So I'm going to try a slightly more...conventional (or widely suggested, at least) approach:

  1. Create controllers with just enough information so that your pages will display.  No setting variables yet or other logic!
  2. Fill out the views with as much HTML and fake data as you need.  Site have a sign-in page?  Leave a link to "force sign-in" the user that simply sets them to an authenticated state.  All it should do is set a session variable
  3. Spec out the models.  Don't check for validation yet, just check for core functionality, i.e. there is a User table, the first user has a name of Foo and email of [email protected], etc.
  4. Fill out your model code so that the specs pass -- this includes migrations with sample data (these can be removed in a later migration).
  5. Spec out your controllers/views.
  6. Fill out your controllers/views so they pass specs.
  7. Do the rest of the little things that need doing, like validation, error messaging, authentication, styling, etc.
  8. Revel in having finished a project.

Hopefully I'll get further than step 3 this way! I'm going to try to focus more on content/frontend instead of getting bogged down in the backend, and I want to actually write specs.

Any comments/suggestions?

Filed under: musing, ruby Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.