|
Help with choosing design pattern
Hello. I'm new to design patterns. "Design" is also a skill that I think few people have because it requires fairly abstract thinking and requires one to think in very broad terms. Being able to take "easy" notions of inheritance, polymorphism, interfaces, etc., then make use of them for a good design I think is very difficult. That is, I've seen many programmers simply take a bunch of functions, a bunch of variables, then stuff them all in a "class" and call it OOP when it is not, but I don't know how to get good at OOP. Does it come by experience? If that were true, why is some of the worst code I've ever seen written by people with 20+ years of experience. Well, needless to say, I have a question.
Say I wanted to make 2 APIs work together. One API is legacy stuff, and it can't be changed, but the other API will be written from scratch. The new API has to contain all functionality of the old one (because I can't rewrite everything), but the new one will contain additional features. So, clients will basically be using the new API and using old functionality through it along with new features.
To me, it seems like the Adapter design pattern would be useful, but also maybe the Bridge pattern. The Adapter because the two APIs will have different interfaces and the old one already exists, but I had the impression that Adapter was meant to be used when both interfaces have already been written, so that's when I think of Bridge. Can anyone make suggestions?
|