CSE 403 Software Design
References Anderson, Richard. ‘Design Patterns’ Lecture http://www.cs.washington.edu/education/courses/cse403/02au/Slides/Lecture14.ppt JDepend. http://www.clarkware.com/software/JDepend.html JavaNCSS. http://www.kclee.com/clemens/java/javancss/
Question to keep in mind How is you design coupled?
Experts vs. Novices Experience Higher level thought Chunking Idioms Techniques Examples
Examples of expertise Chess playing Mathematics Programming Experts view pieces in groups Mathematics Integration by trigonometric substitution Programming for (int i = 0; i < n; i++) a[i] = b[i];
Design patterns in Architecture Alexander: "Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to the problem. In such a way that you can use this solution a million times over, without ever doing it the same way twice."
Design Pattern Pattern name: Strip mall. Problem: Make small commercial establishments and franchises accessible to car driving customers. Solution: Parking area with store fronts facing parking. Uniform construction. Consequences: Traffic flow, congestion, parking availability, building rents.
Gang of Four Gamma, Helm, Johnson, Vlissides Catalog of design patterns for software
Classification of patterns Creational Abstract factory, builder, factory method, prototype, singleton Structural Adapter, bridge, composite, decorator, façade, flyweight, proxy Behavioral Chain of responsibility, command, interpreter, iterator, mediator, memento, observer, state, strategy, template method, visitor Original GoF patterns
Model/View/Controller Example of putting basic design patterns together Model - internal representation of the data and how it changes View - display of the model (can be more than one) Controller - how the model is controlled by user Goal - be able to change views and controllers without changing the model or knowing details of model
JDepend Example <target name="jdepend"> <jdepend format="xml" outputfile="docs/jdepend-report.xml"> <sourcespath> <pathelement location="classes" /> </sourcespath> <classpath location="classes" /> </jdepend> <style basedir="docs" destdir="docs" includes="jdepend-report.xml" style="${ant.home}/etc/jdepend.xsl" /> </target>
JavaNCSS Example <taskdef name="javancss" classname="javancss.JavancssAntTask" classpath="${CLASSPATH}"/> <target name="javancss"> <javancss srcdir="src" includes="**/*.java" generateReport="yes"/> </target>
Setup Needed for Examples JDepend Make sure $JDEPEND_HOME/lib/jdepend.jar is in CLASSPATH JavaNCSS Make sure all Jar-files in $JAVANCSS_HOME/lib are in the CLASSPATH
Back to the Question How is you design coupled? Tightly Coupled or Loosely? MVC attempts for a Loosely Coupled System Generally Loosely Coupled is Better