Seconded. I've been trying to break the "potentially variable data MUST go in a database" pattern for a while - any sufficiently large organisation and DB changes go through more effort but less testing rigor than code changes anyway.
There was an excellent talk by .. somebody .. at a RORO .. some time ago .. about how they approached a similar problem: 1. Oh my god! We have too many variants! Put it in a database! 2. Oh my gawd! Our database is a mess of senseless key/value tables and incomprehensible joins! Write a lightweight DSL and store it in Ruby classes! 3. Profit, zen. But now we're quite off-topic. On Fri, Sep 2, 2011 at 3:32 PM, Ben Hoskings <[email protected]> wrote: > Deploying your app should be easy enough that that doesn't matter. > > You have to change the values somewhere -- if they're stored in the DB, > you're changing them in an admin interface. I'd rather use my editor and > git. :) > > Also, this way, you update the specs along with the rates, which reduces > the chances of cock-ups. > > - Ben > > > > On 02/09/2011, at 3:22 PM, Anthony Richardson wrote: > > > Should the tax rates be loaded from a database in your app? > > > > With your current solution you will need to rewrite your application and > > tests each year they change the tax rates (often). Not to mention special > > cases like the flood levy. > > > > Cheers, > > > > Anthony > > > > > > > > On Fri, Sep 2, 2011 at 12:04 PM, Michael Gall <[email protected]> > wrote: > > > >> Hi guys, > >> > >> I'd love to get some feedback on a spec I'm writing. It's a tax > calculator > >> for australian taxation rates - nothing too complex just yet, but some > of > >> the calulation specs feel wrong, but I don't know a better way. > >> > >> Thanks in advance. > >> > >> > >> describe TaxCalculator do > >> describe "low income bracket" { > >> before { subject.income = 5000 } > >> it { subject.calculate.should == 0 } > >> } > >> > >> describe "15c tax bracket" { > >> before { subject.income = 10000 } > >> it { subject.calculate.should == 4000 * 0.15 } # the tax bracket is > 15c > >> in the dollar between 6000 and 37000 > >> } > >> > >> describe "30c tax bracket" { > >> before { subject.income = 50000 } > >> it { subject.calculate.should == 6000 * 0 + 31000 * 0.15 + 13000 * > 0.30 > >> } # the tax bracket is 30c in the dollar between 37000 and 80000 > >> } > >> end > >> > >> > >> Cheers, > >> > >> > >> Michael > >> > >> > >> > >> > >> -- > >> Checkout my new website: http://myachinghead.net > >> http://wakeless.net > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Ruby or Rails Oceania" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]. > >> For more options, visit this group at > >> http://groups.google.com/group/rails-oceania?hl=en. > >> > > > > -- > > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > [email protected]. > > For more options, visit this group at > http://groups.google.com/group/rails-oceania?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rails-oceania?hl=en. > > -- Michael Pearson The Bon Scotts; http://www.thebonscotts.com -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
