Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
The one constant in software is change. Your code will need to change and adapt over time. We should try to write code that is easy to change in the future. If possible, change without having to edit existing code. This talk is all about the O in SOLID: the Open-Closed principle. I'll explain what the Open-Closed principle is, why this is important and how to structure and refactor code to make it "open for extension but closed for modification". In this talk I'll show you, by example, how to make your code more changeable. In fact, so changeable that you will be able to extend what your program does and how it behaves without modifying a single line of existing code. Starting with a real world example that is painful to extend, I’ll refactor it over many iterations until it truly is Open-Closed. I'll show techniques, trade-offs and some gotchas from real world experience which will help you write more flexible programs in the future. If you’ve never heard of the Open-Closed principle or are unsure how to put it into practice then this talk is for you. I would love to help open the door of this technique and give you the ability to alter your system in a painless way by opening it up to change. Help us caption & translate this video! http://amara.org/v/H498/
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the talk titled **Opening up to Change**, Andy Pike discusses the importance of writing adaptable software code, centralizing on the Open-Closed Principle (OCP), one of the key components of SOLID principles in object-oriented design. He emphasizes the necessity of designing code that is 'open for extension but closed for modification'—meaning that software should allow for new features to be added without altering existing code. **Key Points Discussed:** - The significance of the Open-Closed Principle was introduced, explaining how it allows software evolution without impacting stable, working code, thus reducing the risk of introducing bugs when making updates. - A comparison was made between 'simple' and 'easy' coding practices, emphasizing that upfront effort in building a beautiful and changeable codebase pays off in the long run. - Pike highlights the dangers of conditionals in code, as they tend to complicate business logic by multiplying paths and increasing code duplication, thus making future changes difficult. - Several design patterns were illustrated to adhere to the Open-Closed Principle, including: - **Inheritance**: Creating new classes based on existing ones. - **Dependency Injection**: Passing dependencies into classes to retain flexibility for future changes. - **Decorator Pattern**: Allowing extensions of existing class behaviors without altering their structures. - **Command Pattern**: Encapsulating behavior in classes to allow seamless changes by introducing new classes for additional functionalities. - **Service Locator Pattern**: Enabling runtime behavior lookups to prevent modification of existing code when adding new features. - Pike also advocates for creating numerous well-defined classes rather than overly complex ones, underlining that code should be easy to read and understandable for future developers. - His concluding advice encourages embracing change, writing code that is cleaner and more modular, and the consideration of various design patterns to keep future modifications smooth and maintainable. By emphasizing careful class construction and reducing complexity in decision-making structures, Pike leaves the audience with a better grasp of how to implement design practices that welcome change and reduce long-term maintenance costs.
Suggest modifications
Cancel