3 ms·
In my experience, different API versions come in three varieties: 1) Totally separate code bases (more common at larger companies) 2) An old branch vs. a new
by smt88 12y ago
In my experience, different API versions come in three varieties:
1) Totally separate code bases (more common at larger companies)
2) An old branch vs. a new branch, deployed to different places
3) Separate business logic living in the same branch of the same code base
Which form the company takes is usually just circumstance. It sounds like you want to talk about #3.
If you're on version 1 of the API and don't have concrete plans for a version 2, don't worry about it. "Pre-optimization is the root of all evil" after all. Cross that bridge when you come to it.
How it could actually work in your code depends a lot on the architecture of the code, as well as the language. The solution you choose should consider your resources, as well.
Personally, I've had a lot of issues sharing code between an old API and a new one, even though it sounds like a great idea. The problem is that you have to run unit tests every single time you want to add or change a method on your models. Either that, or you end up adding tons of methods to your models to avoid breakage, and then you have a huge maintenance problem.
So my suggestion would be #2.
- opless 12y agoTotally agree with the #2 conclusion.