Slide 1

Slide 1 text

Design Patterns Part One

Slide 2

Slide 2 text

What Is Software Design? • Software design is the process in which you define the requirements and plan the flow of information for your software. • It’s really more than that, but we’re going to think of it this way for now. • It deals with higher level concepts — more about interfaces than implementations

Slide 3

Slide 3 text

Design Is A Wicked Problem • A ‘wicked’ problem is one that takes solving it to come up with a better solution. • You won’t come up with the best design for something, until you’ve made a worse version of it.

Slide 4

Slide 4 text

Design Is A Sloppy Process • Regardless of your end product. • You will make a lot of ‘wrong’ turns and hit a lot of dead ends. • You will feel like you have no idea what you’re doing.

Slide 5

Slide 5 text

There Will Be Tradeoffs • Everything takes time or space. • Your time is limited -> deadlines. • Every language has different strengths and weaknesses • Certain features may be more important • How you design interactions can either give or take away flexibility for your code to adapt to growing or changing needs.

Slide 6

Slide 6 text

Time For Your First Design Pattern Are you ready?

Slide 7

Slide 7 text

The Facade Pattern • The facade pattern puts a layer between your program and outside interactions. • Creates a consistent interface for your modules to interact with

Slide 8

Slide 8 text

Inputs Modules Without A Facade

Slide 9

Slide 9 text

With A Facade Inputs Modules

Slide 10

Slide 10 text

What Does This Do For Me? • You deal with all of your error handling of bad inputs in one place. • You can give yourself consistently formatted data. • You don’t have to worry about what you’re getting throughout the whole program, just in the facade.

Slide 11

Slide 11 text

A Simple Example The Facade

Slide 12

Slide 12 text

A Simple Example Our program dealing with the cleaned data

Slide 13

Slide 13 text

Advantages • Your code will be more readable and easier to understand. • Less chance of missing error checks, since you’re cleaning the data at its point of entry. • When you’re writing a routine, you can worry about coding good solutions, and not tripping over your own feet.

Slide 14

Slide 14 text

Questions?