Not all requirements can or should be anticipated. Building simple software often means waiting to incorporate future requirements until they're needed. You don't have to completely write off the future, though. By making good decisions, you can make it easy to extend your frameworks in ways you might not have originally intended. You do so by following good design principles:
Methods should be fine-grained and handle a single concept. If your methods bundle up too many concepts, you won't be able to extend the class by overriding the method.
Use Java interfaces
Providing general Java interfaces separates the interface from implementation details. If you see a service or capability that's buried in a class definition, break it out into a separate interface.
This concept always comes up in good Java programming books for a reason. It works.
Code that's hard to read and understand will be hard to extend.
An application with source that can be examined and modified is much easier to extend then a closed-source application.
No comments:
Post a Comment