Skip to main content

Posts

Showing posts from September, 2018

Agile design: SOLID

How do we know how whether the design of a software system is good? Symptoms of poor design. Rigidity . Rigidity is the tendency for software to be difficult to change, even in simple ways.  Fragility .  Fragility is the tendency of a program to break in many places when a single change is made.  Immobility . A design is immobile when it contains parts that could be useful in other systems, but the effort and risk involved with separating those parts from the original system are too great.  Viscosity . Viscosity comes in two forms: viscosity of the software and viscosity of the environment. When faced with a change, developers usually find more than one way to make that change. Some of the ways preserve the design; others do not (i.e., they are hacks). When the design-preserving methods are more difficult to use than the hacks, the viscosity of the design is high.  Needless complexity . Overdesign. Needless repetition . Cu...

Mock pattern

using mock pattern TestPayroll public void testPayroll() {    MockEmployeeDatabase db = new MockEmployeeDatabase();    MockCheckWriter w = new MockCheckWriter();    Payroll p = new Payroll(db, w);    p.payEmployees();    assert(w.checksWereWrittenCorrectly());    assert(db.paymentsWerePostedCorrectly()); }