Live data from Hacker News

Monolith First (2015)

martinfowler.com

31–40 of 356 posts

Re: Monolith First (2015)

#31
post #4

A more common scenario I see is that people start with a monolith that ends up inheriting all the conceptual debt that accumulates as a project evolves. All this debt builds up a great desire for change in the maintaining team. A champion will rise with a clean architecture and design in microservice form that addresses all high visibility pain points, attributing forecasted benefits to the perceived strengths of mic…

When the same practices used to sell microservices get applied to modules, packages and libraries, there is no need to put a network in the middle to do the linker's job.

But too many are eager to jump into distributed computing without understanding what they are bring into their development workflow and debugging scenarios.

Re: Monolith First (2015)

#32
If you imagine a monolith as a service that:

  takes a request 
  -> deserializes it/unpacks it to a function call
  -> sets up the context of the function call (is the user logged in etc)
  -> calls the business logic function with the appropriate context and request parameters
  -> eventually sends requests to downstream servers/data stores to manipulate state
  -> handles errors/success
  -> formats a response and returns it
The main problem I've seen in monoliths is that there is no separation/layering between unraveling a requests context, running the business logic, making the downstream requests, and generating a response.

Breaking things down into simplified conceptual components I think there is a: request, request_context, request_handler, business_logic, downstream_client, business_response, full_response

What is the correct behavior?

  return request_handler(request):
    request -> request_context;
    business_response = business_logic(request_context, request):
      downstream_client();
      downstream_client();
    business_response -> full_response;
    return full_response;
    
  business_response = request_handler(request_context, request):
    return business_logic(request_context, request):
      downstream_client();
      downstream_client();
  business_response -> full_response;
  return full_response;  

  request -> request_context;  
  business_response = request_handler(request_context, request, downstream_client):
    return business_logic(request_context, request, downstream_client):
      downstream_client();
      downstream_client();
  business_response -> full_response;
  return full_response;  
    
  something else?
In most monoliths you will see all forms of behavior and that is the primary problem with monoliths. Invoke any client anywhere. Determine the requests context anywhere. Put business logic anywhere. Format a response anywhere. Handle errors in 20 different ways in 20 different places. Determine the request is a 403 in business logic, rather than server logic? All of a sudden your business logic knows about your server implementation. Instantiate a client to talk to your database inside of your business logic? All of a sudden your business logic is probably manipulating server state (such as invoking threads, or invoking new metrics collection clients).

The point at which a particular request is handed off to the request specific business logic is the most important border in production.

Re: Monolith First (2015)

#33
Now that Fowler himself wrote about it I hope that the masses follow. Next I hope that the trend of going vertical-first comes back. Mr Fowler, could you please write an article on vertical-first scaling?

Re: Monolith First (2015)

#35

I keep saying this every time this topic comes up, have a look at elixir/erlang. The OTP library gives some great reusable patterns (and elixir project is adding new ones[1]) out of the box. You're basically developing a single codebase microservice project which feels like a monolith. You can spread out on multiple machines easily if you need to, the introspection tooling is better than anything you can buy right no…

Neat, but nobody uses Elixir.

Re: Monolith First (2015)

#36
post #9
post #6

Earlier quoted context omitted.

> These are not unusual traits when starting a company as a technical founder. Its actually not unusual to have technical cofounders who have no prior software engineering work experience.

I see two categories of technical founders. 1. The people who have many years of experience building a highly specialized application using domain knowledge gained at their previous job. 2. The new CS grad right out of college who had big dreams, a lot of time, and high risk tolerance. Unclear as to whether they're starting up the company because they failed to get a job elsewhere or because they think they're about…

I'm definitely not in either of those camps, more mid-senior level experience with highly specialised domain knowledge in a completely unrelated field (neuro/QEEG feedback training before, now fintech/insurance)

Re: Monolith First (2015)

#37

If you imagine a monolith as a service that: takes a request -> deserializes it/unpacks it to a function call -> sets up the context of the function call (is the user logged in etc) -> calls the business logic function with the appropriate context and request parameters -> eventually sends requests to downstream servers/data stores to manipulate state -> handles errors/success -> formats a response and returns it The…

I guess it all boils down to building software with modular structure rather than mixing business logic all around. I personally think that it is easier to isolate business logic with microservice structure, but you can also make a huge mess. You can also make really good modular monolith, where business logic and state is where it belongs and not spread everywhere.

Re: Monolith First (2015)

#39

> I feel that you shouldn't start with microservices unless you have reasonable experience of building a microservices system in the team Well, yeah... obviously. That's not the same thing as it being bad to start with microservices generally. I just don't agree with this at all. The designer of the architecture clearly does need to know how to design service-based architectures and needs to have a very strong unders…

What if those boundaries change because an initial assumption turns out to be wrong? In a monolith, no biggy. With microservices, huge pain. Moving to microservices is something you do to optimise scability, but it comes with costs. A major cost is the reduction in flexibility. Starting a new not-very-well-understood thing needs massive flexibility.

I think we've found in many situations that the microservice boundaries make it easier to change things. We were pretty careful in making fairly conservative choices initially though, and split some of the bigger systems up more over time.

Re: Monolith First (2015)

#40
post #31
post #4

A more common scenario I see is that people start with a monolith that ends up inheriting all the conceptual debt that accumulates as a project evolves. All this debt builds up a great desire for change in the maintaining team. A champion will rise with a clean architecture and design in microservice form that addresses all high visibility pain points, attributing forecasted benefits to the perceived strengths of mic…

When the same practices used to sell microservices get applied to modules, packages and libraries, there is no need to put a network in the middle to do the linker's job. But too many are eager to jump into distributed computing without understanding what they are bring into their development workflow and debugging scenarios.

When I started programming, linking was the only way of packaging software in mainstream computing, if it was so superior we wouldn't have moved away from it.
Post reply on HN