Download - Intro To Software Architecture
Software ArchitectureEthode University
“I hear and I forget. I see and I remember. I do and I understand.”
- Confucius
The Big 3Follow these three simple rules for clean code.
Stay DRYDon’t Repeat Yourself
Keep It Super SimpleComplexity is expensive. Less complexity = less bugs.
Less complexity = easier to read and understand.
Do the simplest thing that could possibly work.
YAGNITrust in your ability to solve problems as they arise. Don't build
something now that you _might_ need in the future. If you don't need it now, or it's not in the requirements, do not build it.
Good Rules of Thumb
- Keep your class, variable and method names verbose – avoid uncommon abbreviations
- Always think: “What am I actually doing?” – design your API the way you would want to use it. Tell your app to do something, don’t ask.
- Keep flow paths to a minimum: remove unnecessary else statements whenever possible
- Reduce complexity by keeping your indentations to one level ideally – forces you to extract behavior into more modular code
The SOLID Principles
S: Single Responsibility
Separation of concerns
- Routing- Validation- Filtering- Logging- Formatting
- Mapping- Notifications- Parsing- Object Creation- Rendering- Querying
O: Open/Close Principle
Don’t add a basement to a finished house.
L: Liskov Substitution Principle
In other words: Design To An Interface. Whopper and BigMac both implement the HamburgerInterface
I: Interface Segregation PrincipleKeep your interfaces small. By following this principle, you
will implicitly follow the Open/Closed Principle, win-win
Classes that implement interfaces should not be forced to implement methods that they do not use. Violation of this principle is a red flag that your interface is too big and should be broken down into smaller interfaces
D: Dependency Inversion Principle
Communication between high level and low-level classes should be done through abstraction. In other words, reference interfaces and not concrete classes
- File System - Database - 3rd Party Libraries - Mailing - Web Services - Configuration
Onion Architecture
Pattern RecognitionLearning different frameworks helps you recognize common architecture
patterns and which ideas consistently emerge as best practices.
Most problems can be solved with another layer of abstraction.