An Introduction To Software Development - Design Strategies

13
An Introduction To Software Development Using Python Spring Semester, 2015 Class #8: Design Strategies

Transcript of An Introduction To Software Development - Design Strategies

Page 1: An Introduction To Software Development - Design Strategies

An Introduction To Software

Development Using Python

Spring Semester, 2015

Class #8:

Design Strategies

Page 2: An Introduction To Software Development - Design Strategies

Homework #1

• Title: Lakeland Hospital Patient Collection Application

Page 3: An Introduction To Software Development - Design Strategies

Homework #1: Fred Johnson

Johnson,Fred,N,2763 Filibuster Drive,Lakeland,FL,37643,M,05/27/1935,Y,164-55-0726,1234567890

Page 4: An Introduction To Software Development - Design Strategies

Homework #1: Betty Williams

Williams,Betty,L,701 Collage Avenue,Orlando,FL,31234,F,11/27/1971,N,948-44-1038

Page 5: An Introduction To Software Development - Design Strategies

Homework #1: Hector Ling

Ling,Hector,X,1500 Raceway Lane,Tampa,FL,32785,M,10/17/2003,Y,193-74-0274, Smith, John

Page 6: An Introduction To Software Development - Design Strategies

Dating Is HARD! Let’s Create Software To Help Track Things

• Need to account for multiple dates with the same person.

• Different things are done on different dates

• Food is a critical part of every date

Image Credit: thisdateisover.com

Page 7: An Introduction To Software Development - Design Strategies

But What About Flowers? Every Date Needs Flowers!

• If we decide that dates need flowers, then we’re going to have to change our code

• Every date needs different types of flowers

• Flowers are used at different points in different dates

Image Credit: www.clipartpanda.com

Page 8: An Introduction To Software Development - Design Strategies

Our Design Has A Problem!

• When we add a behavior, like including flowers, we end up making a lot of changes in different places.

• What seemed like a simple change (include flowers) ended up making multiple changes in multiple places.

Image Credit: www.clipartpanda.com

Page 9: An Introduction To Software Development - Design Strategies

Our Design Is BreakingThe Single Responsibility Principal

• Single Responsibility Principal: Every object in your system should have a single responsibility and all of the object’s services should be focused on carrying out that single responsibility.

• When we add support for flowers we have to go back and mess with all three date actions.

• How would we handle adding support for jewelry, a concert, or a sleepover?

Image Credit: kenmorebranch.akronlibrary.org

Page 10: An Introduction To Software Development - Design Strategies

The Ripple Effect Is BAD!

• The ripple effect occurs when one small change to your software causes a ripple of changes throughout your software.

Image Credit: qwerty2jam.wordpress.com

Page 11: An Introduction To Software Development - Design Strategies

You Want To Create DRY Code

• DRY: Don’t Repeat Yourself

• Avoid having any duplicate code in your software. Abstract or separate out things that are common and place them in a single location.

• DRY is about having each piece of information and behavior in your system in a single sensible place.

Image Credit: www.graphicsfactory.com

Page 12: An Introduction To Software Development - Design Strategies

What We Covered Today

1. Good design strategies

2. Why grouping code into segments makes sense

3. Single Responsibility Principal

4. D.R.Y.

Image Credit: http://www.tswdj.com/blog/2011/05/17/the-grooms-checklist/

Page 13: An Introduction To Software Development - Design Strategies

What We’ll Be Covering Next Time

1. Version Control

2. Configuration MgmtSoftware

Image Credit: http://merchantblog.thefind.com/2011/01/merchant-newsletter/resolve-to-take-advantage-of-these-5-e-commerce-trends/attachment/crystal-ball-fullsize/