Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Rediscovering ModularityChris ChedgeyStructure101Gearconf 2012 Dusseldorf
Summary•   We do modularity at implementation levels (classes)•   We don’t do modularity at logical levels (above classes)...
Modularity – divide and conquer•   High cohesion          •   S/W-eng 101•   Low coupling           •   Eng-101•   Abstrac...
Levels of code quality        Physical                    Imagination                         or       Logical            ...
The modularity wasteland•   Methods ok•   Classes ok•   Handfuls of classes ok•   But almost no logical    organization of...
Why?•   Logical design is not necessary early on – let it emerge•   In fact it might get in the way•   At some point the s...
Symptoms… as code-base grows…  •   Cost per feature increases  •   Unexpected impacts of change  •   Unreliable schedules ...
Solutions?     •   Do nothing different           •   or     •   Restructure           •   or     •   Rebuild
What is restructuring?Refactoring                               Restructuring•   “Changing code without                 • ...
Step 1: Levelization•   Remove tangles                          •   Balance       •   Cyclic dependencies              •  ...
Unlevelized•   Acyclic Dependency Principle (ADP)      •   Morning after syndrome•   Release/reuse Principle•   Abstractio...
Levelize first•   A structure without tangles is much easier to manipulate•   A milestone in its own right•   A code-base ...
Visualizing structure - LSM•   Info points: #items•   Composition, dependency, flow,    whole codebase, filtering,    summ...
Levelization•   Look at existing logical design (packages, namespaces,    assemblies, …)•   Look at the raw material (clas...
More restructuring strategies•   Levelize first                      •   Divide disjoint packages early•   Break v large c...
Summary•   We do modularity at implementation levels (classes)•   We don’t do modularity at logical levels (above classes)...
Thank you!             Questions?
Upcoming SlideShare
Loading in …5
×

Rediscovering Modularity

1,157 views

Published on

From my talk at Gearconf 2012 Dusseldorf

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Rediscovering Modularity

  1. 1. Rediscovering ModularityChris ChedgeyStructure101Gearconf 2012 Dusseldorf
  2. 2. Summary• We do modularity at implementation levels (classes)• We don’t do modularity at logical levels (above classes)• This is not scalable• We discover it is not scalable when code-base creaks• The codebase can be salvaged (restructured)• Step 1: Levelization
  3. 3. Modularity – divide and conquer• High cohesion • S/W-eng 101• Low coupling • Eng-101• Abstraction • Human-101 !!• Information hiding • We ALL know about modularity!• Interfaces• Clear responsibility• …
  4. 4. Levels of code quality Physical Imagination or Logical Visualization Classes Functions Attention Lines of code
  5. 5. The modularity wasteland• Methods ok• Classes ok• Handfuls of classes ok• But almost no logical organization of classes into higher level abstraction• This is not scalable
  6. 6. Why?• Logical design is not necessary early on – let it emerge• In fact it might get in the way• At some point the sea of classes is too big (50kloc?)• This point is invariably overshot (no pain => business as usual)• Package/namespace structures are accidental (like folders)
  7. 7. Symptoms… as code-base grows… • Cost per feature increases • Unexpected impacts of change • Unreliable schedules • Test cycles increase • Reuse less • Value of your code base declines • Asset or liability?
  8. 8. Solutions? • Do nothing different • or • Restructure • or • Rebuild
  9. 9. What is restructuring?Refactoring Restructuring• “Changing code without • “Reorganizing a code-base modifying behavior to improve without modifying the code to nonfunctional attributes.” improve modularity” Cost of• Code is readable development• Code-base is understandable• A lot of invasive code editing • Minimal invasive code editing• Scope: small worlds of a few • Scope: whole code base; what classes at a time; what you see you don’t see in the IDE in the IDE.
  10. 10. Step 1: Levelization• Remove tangles • Balance • Cyclic dependencies • Eliminate tangles by putting everything in one place - creates• Without fat fat • Too much complexity in one place (method, class, package, • Eliminate fat by simplistically bundle, …) partitioning fat items – creates tangles Checked automatically
  11. 11. Unlevelized• Acyclic Dependency Principle (ADP) • Morning after syndrome• Release/reuse Principle• Abstraction, distance from the main sequence• Clear responsibility?• Divide and conquer?• A tangle of items is really a single item
  12. 12. Levelize first• A structure without tangles is much easier to manipulate• A milestone in its own right• A code-base that is much easier to understand• Many simply focus on keeping (over-)complexity out• Once levelized, other modularity adjustments are “easy”
  13. 13. Visualizing structure - LSM• Info points: #items• Composition, dependency, flow, whole codebase, filtering, summarizing• Designed specifically for restructuring• Demo • LSM • Adjusting levelized structure • Adjusting within tangle
  14. 14. Levelization• Look at existing logical design (packages, namespaces, assemblies, …)• Look at the raw material (classes)• Decide top-down vs. bottom-up• Break up very large class tangles• Prioritize non-invasive changes• Simulate changes before implementing
  15. 15. More restructuring strategies• Levelize first • Divide disjoint packages early• Break v large class tangles early • Break up v. fat classes and packages early• Top-down or bottom-up decision • Consider mixed granularity• Do as much as possible by moving classes and packages • …• Merge parallel structure• Address tangles top-down
  16. 16. Summary• We do modularity at implementation levels (classes)• We don’t do modularity at logical levels (above classes)• This is not scalable• We discover it is not scalable when code-base creaks• The codebase can be salvaged (restructured)• Step 1: Levelization vote.jax-awards.com
  17. 17. Thank you! Questions?

×