• 0 Posts
  • 8 Comments
Joined 1 year ago
cake
Cake day: June 24th, 2023

help-circle


  • My colleague was working on migrating around dozens of batch jobs written in Java. All jobs had JPA/Hibernate but people which were writing those jobs didn’t understand abstraction and encapsulation. It end-up as vendor locked as you can imagine. Procedures, reading cursors, Oracle specific functions, metadata, logic spread between Java and PL/Sql, all the fun stuff, you know. So it took around one year of work to migrate to Postgres. And that’s with support of DBA who was helping with rewriting most complicated queries and procs. So yeah, don’t worry about that DBMS specific features.

    Don’t get me wrong, though. Efforts spent on making design decisions should be proportional to potential size/complexity growth of the software. If you building todo list , how many different queries you might have in fairly pessimistic scenarios? Maybe couple dozens. Don’t bother with JPQL or HQL. If you expect your app to grow significantly. I’d do as much as possible to avoid my colleague’s fate.


  • I don’t think loop vs recursion choice is what significantly impacts performance in most cases. Most of the software I saw, suffer performance because of wrong API design or overall architecture. If app needs to fetch 100 objects from API which can provide only one object at the time no optimization will save that app.

    App team - we need bulk API.

    API team - cannot because of capacity, budget, backward compatibility, DB, 3rd patry API, not a KPI

    Also it’s mostly QAs measuring performance and validating it with product guidelines which set by person who mostly detached from specific product and sometimes reality.




  • I didn’t get do you do integrations besides of your DB.

    To me architecture sounds good anyway. I’m not GO dev but it looks like stack is your main problem not architecture itself. Multiple models is great long term approach which makes sure you are not leaking implementation details of your persistence/3rd party services to your client. You have layer of mappers where you can enrich model in optimal way and at the same time you can accommodate whatever client request/payload quirks you may need. Yes it’s sometimes annoying to add one field and pass it across all layers but it’s the price and software development is all about balance and compromises. I worked in projects that didn’t follow this architecture and any kind of change in DB/3rd party were cascading through entire application so end up changing hundreds of files instead of couple of models and few mappers

    You may have issues with this architecture if you invoke services directly one from another for complex use cases. This can couple things together. If that’s what’s happening think if can apply Facade. Try using/reusing more trivial and focused services in Facade to make sure that for example Order service does not depend on Client service. Leave it to ClientOrderFacade.