scea – decomposition strategies example – part 2

In part 1, I posed a question on decomposition strategies.   Before I present my answer to the example, I want to point out a few things:

  1. An experienced architect (or organizer) is going to be able to do this in one pass.  This is ok.  Even in the real world, once you’ve seen a problem before you take shortcuts to the solution and don’t think about each step.  Just like a child will count on their fingers to figure out 9 x 6 and an adult will just say 54.
  2. If you aren’t comfortable with the concept of decomposition yet, take it slower.  Force yourself to pick something that splits the list into two pieces.  Then do it again.  Or give a reason for why you are making everything into a category.

My sample solution

Here I walk through the five layers presented in Cade & Sheil (listed in part 1).

Group 1 Technique – Distribution

I choose distribution over layering as my first technique because some of the items in this list represent different subsystems.

Accounting System Food System
  • coupon
  • fork
  • gift card
  • knife
  • paper cup
  • paper receipt
  • pen
  • spoon
  • chicken
  • lettuce
  • mayonnaise
  • mustard
  • pickle
  • onion
  • roast beef
  • roll
  • rye bread
  • tomato
  • turkey
  • wheat bread
  • white bread
  • wrap
  • Group 2 Technique – Functionality

    I choose functionality over exposure and generality.  Since there are clear business groupings, it makes sense to separate on that level.

    Accounting System Food System
    Eating supply Check out item
    • fork
    • knife
    • paper cup
    • spoon
    • coupon
    • gift card
    • paper receipt
    • pen
    Bread Meat Condiments Veggies
  • roll
  • rye bread
  • wheat bread
  • white bread
  • wrap
  • chicken
  • roast beef
  • turkey
  • mayonnaise
  • mustard
  • lettuce
  • pickle
  • onion
  • tomato
  • Groups 3-5 – not needed

    The system is sufficiently decomposed.  All done.

    scea – decomposition strategies example – part 1

    Decomposition strategies are described in the Cade & Sheil Sun Certified Architect (SCEA) study guide.  Or maybe I should say the Oracle Certified Master, Java EE 5 Enterprise Architect (OCMJEA) now.  When I read the study guide and and took SCEA part 1, I found this to be very straightforward.  Then I read a thread in the CodeRanch certification forum where two people asked for tutorials or examples.  I searched online and didn’t find anything so decided to write one.

    What is decomposition?

    Decomposition is taking a big thing and turning into a bunch of smaller things.  In software architecture/design, this is used in designing a system.  Suppose you have 1000 classes.  How do you separate them into projects and packages that are manageable.  Decomposition can also be thought of as organizing or categorizing.  (Thanks Scott! This is a good way to put it.)

    Types of decomposition

    Case & Sheil list the following types of decomposition.  It is common not to use all groups in the same system.

    1. Layering or Distribution – layering refers to layering of the system and distribution refers to distribution of resources.  While the book treats these as one category a large system may do layering within a particularly large distribution area.  For example, distribution may go by database vs application server.  Then layering may happen within the application server.
    2. Exposure, Functionality or Generality – exposure refers to black box vs white box type exposure on several levels.  Functionality is about the business domain  (and something we often think about when designing packages.)  Generality is about reuse between systems.
    3. Coupling and Cohesion or Volatility – these should be familiar to any developer.  Low coupling and high cohesion insulate packages.  And keeping the things you expect to change often away from the other things makes maintenance cheaper.
    4. Configuration – when environment/outside things change independently of other things, it makes sense to isolate them.
    5. Planning and Tracking or Work Assignment – when done with everything else, further separating by project management concerns makes sense.  Especially when teams are from different organizations.

    Example

    Suppose I have the following things in my sandwich shop.  We want to decompose the list in at least two passes so we have no more than 5 items in a category at the end. How you could decompose the list. What strategy would you use first? Why? What would you do next?

    • chicken
    • coupon
    • fork
    • knife
    • lettuce
    • gift card
    • mayonnaise
    • mustard
    • pickle
    • onion
    • paper cup
    • paper receipt
    • pen
    • roast beef
    • roll
    • rye bread
    • spoon
    • tomato
    • turkey
    • wheat bread
    • white bread
    • wrap

    Answer

    Check part 2 for my answer with explanation.  If you want to take a stab at it – either before or after I’ve posted the answer – go for it.  There is more than one correct answer.  If you post your answer as a comment in this thread, I will give my thoughts on it.  If you post it in the CodeRanch/JavaRanch thread, you may get feedback from others as well.

    restoring my iBrick to an iPad

    This week, I updated my iPad to OS 3.2.2. It didn’t go well.

    What happened:

    1. Plugged in iPad to laptop.
    2. iTunes noted there was an OS update and suggested I backup the iPad before applying it.  I did.  Whew!  This turned out to be a blessing.
    3. Selected option to update.
    4. Got error that could not update.  With error code 14. Apple lists the error codes which is nice.
    5. Tried again but iTunes said my iPad needed to be restored to factory state to work again.  Not happy at this point.
    6. Got a different error code on restore.  Now really nervous.  Tried unplugging and replugging USB.  Seemed to help.
    7. Restore worked

    Ok now I’m “restored” to factory settings.  How do I get back to using the iPad.

    1. Synced with iTunes.  This gave me most system settings and some data back.  (It didn’t put my password back, but that was the only thing noticeably missing.)
    2. Most of my apps aren’t here at this point and they have data of their own.  I’m a little nervous at this point.
    3. iTunes as the list of apps that were installed, but I don’t see an easy way to put them back.
    4. Went through the app store and re-downloaded them one by one.  At least iTunes recognized they were bought (thanks to an up to date backup) and didn’t charge me again.
    5. Tried some of the apps.  They do still have the data from the iTunes sync.  That means iTunes does sync data even if the app it goes with isn’t currently installed.

    Summary

    • Best thing – I didn’t lose any data
    • Worst thing – re-downloading each app is tedious.  Can’t iTunes send a list to the iPad and have the app store download everything on that list?