Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Planned Obsolescence in Software

Planned Obsolescence in Software

We strive to create designs that will last. But in doing so, we run the risk of over-engineering: building in so many abstractions at the beginning of a project that it degenerates into unmaintainable code.

What causes these risks, and what can we do about it? If there were a simple answer, everyone would be doing it already. Instead, we have to make do with a few heuristics, practices, and insights into human nature.

Erin Dees

July 25, 2013
Tweet

More Decks by Erin Dees

Other Decks in Programming

Transcript

  1. Planned Obsolescence Built to Last, or Build One to Throw

    Away? OSCON 2013 Baq Haidri • @baqhaidri Ian Dees • @undees
  2. — Should software makers apply the planned- obsolescence strategy? —

    Like, a self-destructing Github repo? — More like designing things for the correct lifespan.
  3. Computer programs are... machines with far more moving parts than

    any engine: the parts don’t wear out, but they interact and rub up against one another in ways the programmers themselves cannot predict. —James Gleick
  4. def create_parser xml = read_ridiculously_long_xml_file config = hash_from_xml(xml) type =

    config["type"] case type when "ANTLR" then ANTLRParser.new when "yacc" then YACCParser.new else raise "Unknown parser #{type}" end end
  5. GPIBDevice::GPIBDevice(int newAddress, int newSecondary, double newTimeOut, bool txEoi) : address(newAddress),

    secondary(newSecondary), timeout(ConvertTimeout(newTimeout)), sendEoi(txEoi) { // bunch of options code... }
  6. GPIBDevice::GPIBDevice(int newAddress, int newSecondary, double newTimeOut, bool txEoi, bool sendCr,

    bool sendLf, bool expectCr, bool expectLf, int bufSize, short newId) : address(newAddress), secondary(newSecondary), sendEoi(txEoi), sendReturn(sendCr), sendLinefeed(sendLf), expectReturn(expectCr), expectLinefeed(expectLf), bufferSize(bufSize), id(newId), pBuffer(NULL), receiveLength(0) { // bunch of options code... }
  7. The cost [of adding a feature] also includes the addition

    of an obstacle to future expansion.... You will usually wind up with a codebase that is so fragile that new ideas that should be dead-simple wind up taking longer and longer to work into the tangled existing web. The trick is to pick the features that don’t fight each other. —John Carmack
  8. public class Voltron { public Voltron setType(Type type) {} public

    Voltron setColor(Color color) {} List<Part> getParts() {} public static void main(String[] args) { Voltron v = new Voltron(); v.setColor(YELLOW).setType(LION).render(); } }
  9. public class Voltron extends Robotron { // ... public static

    void main(String[] args) { Voltron v = new Voltron(); v.setColor(YELLOW).setType(LION).render(); } }
  10. public abstract class Robotron implements Transformable<Robotron> { @Override public Robotron

    render() { for (Part part : this.getParts()) { part.render(); } return this; } // ... }
  11. You look back at all the projects you’ve ever been

    on, and you can’t think of a single piece of code that wasn’t rewritten at least once, maybe half a dozen times, over the years. —Steve Yegge, http://bit.ly/yegge-mystery-3d
  12. class BrewerTest : public CoffeeTest { public: bool testBrewing() {

    brewer.brew(); COFFEE_ASSERT(brewer.brewed()); } };
  13. class BrewerTest : public CoffeeTest { public: bool testBrewing() {

    brewer.brew(); COFFEE_ASSERT(brewer.brewed()); } };
  14. class BrewerTest : public Test { public: bool testBrewing() {

    brewer.brew(); ASSERT(brewer.brewed()); } };
  15. YOU

  16. class CHello : public CHelloBase { public: IPFIX(CLSID_CHello); CHello(IUnknown *pUnk);

    ~CHello(); HRESULT __stdcall PrintSz(LPWSTR pwszString); private: static int cObjRef; };
  17. ?

  18. class Adder def add(a, b) space = \ @antlr_parser.curr_node.space_needed do_stuff_to(a,

    space) do_stuff_to(b, space) result = \ @antlr_parser.curr_node.mkspace(space) result.fill_with(a + b) end end
  19. class Adder def add(a, b) space = \ @antlr_parser.curr_node.space_needed do_stuff_to(a,

    space) do_stuff_to(b, space) result = \ @antlr_parser.curr_node.mkspace(space) result.fill_with(a + b) end end
  20. def create_parser xml = read_ridiculously_long_xml_file config = hash_from_xml(xml) type =

    config["type"] case type when "ANTLR" then ANTLRParser.new when "yacc" then YACCParser.new else raise "Unknown parser #{type}" end end
  21. [["Fahrenheit", 32.0], ["Kelvin", 273.0]].each do |units, expected| it "converts to

    #{units}" do method = units.downcase.to_sym actual = celsius.send(method) actual.must_equal(expected) end end
  22. | Celsius | Fahrenheit | Kelvin | | 0 |

    32 | 273 | | 100 | 212 | 373 |
  23. measurement* found = find_if(table, table + size, compose1( // f(g(pair)),

    where: bind2nd(greater<int>(), day), // f(num) is "num > day?" select1st<measurement>())); // g(pair) is "pair.first" return found ? *found : no_meas;
  24. for (int i = 0; i < size; ++i) {

    if (table[i].first > day) { return table[i]; } } return no_meas;
  25. A generic probabilistic metaheuristic for the global optimization problem of

    locating a good approximation to the global optimum of a given function in a large search space. —http://en.wikipedia.org/wiki/Simulated_annealing
  26. class Storable { public: virtual ~Storable() {} virtual void write(const

    char* k, void* v) = 0; }; class WORNStorage : public Storable { public: virtual void write(const char* k, void* v) { // poke hardware registers } };
  27. class FakeStorage : public Storable { public: virtual void write(const

    char* k, void* v) { // DO NOTHING! } }; FakeStorage fake; someFunctionThatStores(fake);
  28. Organizations which design systems... are constrained to produce designs which

    are copies of the communication structures of these organizations. —Melvin Conway
  29. “We’re screwed. The design is going to be bureaucratic and

    dysfunctional, just like our team.” The Pessimist:
  30. The Opportunist: “Sweet. If we organize the team like so,

    the design will naturally fall out the way we want it to.”
  31. Bad programmers worry about the code. Good programmers worry about

    data structures and their relationships. —Linus Torvalds
  32. If you can get 90 percent of the desired effect

    for 10 percent of the work, use the simpler solution. —Bob Scheifler and Jim Gettys
  33. get '/' do haml :index end get '/projects/:id' do @project

    = Project.find params[:id] haml :project end
  34. @@index %ul - Project.all.each do |pj| %li %a{:href => "/projects/#{pj.id}"}

    = pj.name @@project - @project.documents.each do |d| %li= d.title
  35. Chicken sexing The experts had no idea how they had

    acquired their skills in the first place, or how to transmit those skills to others. —Richard Horsey
  36. Chicken sexing We require training, or a great deal of

    detailed observation, in order for us to notice the relevant features, and thereby allow our unconscious mechanisms to acquire the diagnostic cues —Richard Horsey
  37. We control complexity by building abstractions that hide details when

    appropriate. —Harold Abelson and Gerald Sussman
  38. public interface Mapper<K1, V1, K2, V2> /* ... */ {

    void map(K1 key, V1 value, OutputCollector<K2, V2> output, Reporter reporter) throws IOException; }
  39. If you need something once, build it. If you need

    something twice, pay attention. If you need it a third time, abstract it. —Derick Bailey
  40. http://i.lvme.me/hvs3fc1.jpg http://www.flickr.com/photos/trialsanderrors/2741360422 http://commons.wikimedia.org/wiki/ File:Colosseum_Colosseo_Coliseum_(8082864097).jpg http://commons.wikimedia.org/wiki/File:Green_field.jpg http://picardfacepalm.com/ http://www.greenandgoldrugby.co.za/plan-a/ http://commons.wikimedia.org/wiki/File:Bitcoin.png http://www.wpclipart.com/computer/keyboard_keys/special_keys/ computer_key_Delete.png.html

    http://www.flickr.com/photos/72787861@N00/5981733915 http://www.flickr.com/photos/tjfaust/4452365182/ http://www.ariel.com.au/jokes/The_Evolution_of_a_Programmer.html http://origin-ars.els-cdn.com/content/image/1-s2.0-S0360835201000213-gr5.gif http://upload.wikimedia.org/wikipedia/commons/f/fc/Slide_in_Parque.jpg http://img.archiexpo.com/images_ae/photo-g/large-water-slide-for-aquatic- parks-64440-3624991.jpg http://www.break.com/surfacevideo/stuart-smalley-michael-jordan-snl/family- off/ http://twistedsifter.com/2012/04/50-animated-gifs-for-every-situation-ever/