Читать книгу Beginning Programming All-in-One For Dummies - Wallace Wang - Страница 47

Design Patterns

Оглавление

Although every program is different, all programs tend to require similar types of solutions. Rather than force programmers to reinvent solutions, computer scientists have identified common solutions to specific types of problems. These common solutions are called design patterns.

The main idea behind a design pattern is to show the best way to solve a specific type of problem. By following these best practices defined by a design pattern, you can spend less time thinking about the optimal way to solve a problem and simply use a design pattern to guide you into solving that particular problem using any programming language.

Design patterns focus on solving three types of common programming problems:

 Creational: Defines the best way to create classes for different purposes

 Structural: Defines the best way to design classes

 Behavioral: Defines the best way for classes to share data and communicate with each other

Think of design patterns as cookie cutters to help you structure your code without telling you specifically how to write that code. By using design patterns, you can (hopefully) spend less time designing the structure of your program and more time writing reliable code faster than before.

Beginning Programming All-in-One For Dummies

Подняться наверх