Raoul Duke
unread,Apr 18, 2013, 4:45:06 PM4/18/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to software_cr...@googlegroups.com
say -- purely hypothetically, mind you!!! -- somebody gives you a spec
or two of sorts about an app they want made. it lets you Add and
Subtract. you write the data model stuff. turns out Add and Subtract
are the same thing just with a different sign on the value, so you
make a Delta class.
then they project changes. somewhat. how much does your code have to change?
i was (hypothetically) trying to make the data model and api be
closeish to the domain, in a correct-by-construction style. like, the
original spec said you could add or subtract. now you can only
subtract. so the data model class i had that was called Delta should
go away, and i should only have Deduction, and it should assert that
the value is constrained appropriately. that kind of thing.
yes, i could add a layer on top that supports the constraints. but
then i'm making extra code for no real purpose at the moment.
shouldn't we only write as much as we need to? (therein lies the
subjectivity rub).
so anyway all my apis and tests need a fair bit of rework because the
assumptions have changed. yes, this is brittle code from one
perspective. from another perspective, it is an api that tries to make
things safer and more clear to the eventual user of it.
how do you personally dial in such things yourself? how do you know
when you can nail things down? how do you know what is too flexible?
how do you know what is too much code? etc.
sincerely.