ooparchitecturesoamonolithic

Differences between Monolithic Architecture and SOA


I confused these two architecture's differences.

Generally, Monolithic Architecture refers to different components of an application being combined into a single business logic.
And, Service Oriented Architecture refers to an application composed of discrete and loosely coupled software agents that perform a required function.

But I learned, OOP and design-pattern aim "One function should have One responsibility" and "Decrease dependencies to increase reuse of function".

So my question is :
1. Do monolithic architecture follow OOP?
2. Differences between these two architecture.


Solution

  • 1. Do monolithic architecture follow OOP?

    Good ones do. Yes. It would be even more of a spaghetti code mess if it was procedural or much harder to write if it was functional. In all the pro companies I've worked for they all had OOP and frameworks like MVP they also incorporate. In my experience supporting companies with problem products, they tended to be a mess. Really boated, little reuse, if one 1MB thing needed to scale the only way to do it was scale the entire 100MB solution.

    2. Differences between these two architecture.

    Service Orientated Architecture IMO is taking the view each function can be an API, its service orientated. Object Orientated Programming has a few tenants, Polymorphic, Reusable, Encapsulated (and Abstract), it's a style of programming, almost opposite to procedural programming etc.

    When you design a service, let's say it's a Weather app that tells temp and also does predictions. You will want to have an abstract generic Weather class, make it support Celsius and Fahrenheit implementations and you can get some polymorphism, or perhaps add an Interface to support different locations or altitude's, and use really generic function names that sound abstract like GetTemp (with function overloads by City, State, Altitude) to encapsulate it in the Weather class.

    So here you design it with the Service Orientation in mind and a solid OOP assembly.

    "One function should have One responsibility" and "Decrease dependencies to increase reuse of function".

    For the second service to predict temp's that will make some calculations and take time to compute so we will want to isolate it, so we can scale it independently. You can do this by using a different project and instead of referencing each other you put in Messaging technology (SQS, RabbitMQ, etc) so they are loosely coupled.

    Note: We can simply cache the static GetTemp results in the other project to easily scale that part of the system.