Hacker News new | past | comments | ask | show | jobs | submit login

Yes, I think the second diagram that you showed is the preferred way of doing things, since using or "dogfooding" the client libraries will ensure they are always tested and correct, plus you'll get immediate feedback from the other developers who work on the apps as well.



In this day and age, your client libraries should be generated automatically. And of course used in your apps/webpage to save time.

See openapi/swagger for good examples how client generation works


I've been using openapi/swagger for generating my clients and honestly think it creates a mess of files and manually keeping clients up to date is not a huge task. I'm not sure that I buy into "your client libraries should be generated automatically" as a blanket statement.


Granted, APIs aren't updated often, but when they are, generated clients can save a lot of time. I can update a generated client in half an hour and be very confident of its correctness, whereas a manually constructed client would take hours to update and test.

Of course, the generated client is not very convenient, being a 1-to-1 mapping with the API. You build a high-level client with the more common operations on top of the generated one.

It's possible to do this in a way that gets you the best of both approaches, with some up-front planning.


Another benefit would be easier testing - you can easily auto-test the logic and separate the testing of the UI.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: