3

I'm about to start planning an internal project management tool for my company. One thing that has always led me wondering is APIs.

Would it be seen as bad practice / too inefficient to create a API first and build the actual site using those API calls rather than implement it twice?

Let me know your thoughts!

2
  • 4
    That would be exactly what I'd do. Separation of concerns is the way to go. There are different layers of the app that ought to be separated, ie. business logic, data access and user interface. The results of those would be the API that you use to glue the parts together. Good luck!
    – Frank Hale
    Commented Sep 25, 2011 at 16:44
  • 1
    This is also the approach I'm taking on my current project. I built the API project first. It will feed an internal web site, then one for external customers/vendors and, eventually, phone/tablet native apps. I do have a common core of interfaces and base classes that help prevent duplication in the projects.
    – jfrankcarr
    Commented Sep 20, 2013 at 4:08

1 Answer 1

2

I completely agree that developing an API will give you a decoupled architecture, and I recommend that.

However, I feel you should be warned that developing the API first increases your risk of developing the wrong API (PM, by the way, is largely about reducing project risk). You will also be tempted to gold-plate your API-- program features that may go unused, which wastes time. Developing the API in conjunction with the application guarantees that it correctly serves the actual application's or applications' needs. Unless you are confident in the accuracy of and your understanding of the requirements, I suggest programming the API one feature at a time with the application.

For example, as you develop the application and discover the precise point at which you need to make an API call, create an interface (depending on the technology) that looks exactly like what you need. You can stub that interface to get the app to run, which is a great tool for checking that the app is still on track with user expectations. ("You want it to work like this, right?") Later, you can implement that interface. If by chance requirements suffer alteration, you won't have spent time building now obsolete infrastructure.

Not the answer you're looking for? Browse other questions tagged or ask your own question.