Showing posts with label Architecture. Show all posts
Showing posts with label Architecture. Show all posts

Friday, March 31, 2017

Microservice Architecture - Explanation, pros and cons


As most Software Developers out there, most of my experience is with (huge) monolithic apps. So when I first read or heard about microservices I was a little confused about how they work and how to implement this kind of architecture, and most important.. does it work? any pros and cons? is it the next step in the development process?

I don't believe microservices can be considered "the best aproach" in every single situation. However, it looks like a good option. But, as everything in life, all is relative...

I'll show you some facts I found on the internet about microservices architecture so you can have a better understanding about it. It you are confused (as I was), hope it helps to clarify some concepts....


1. What is Architecture (Software)?

Architecture is the fundamental organization of a system embodied in its components (i.e. Web Server, Application Server, Databases,Storage, Communication layer, etc…), their relationships to each other, and to the environment (i.e. deployment environment shared server, dedicated server, cloud deployment, etc..), and the principles guiding its design and evolution.

2. What is microservice architecture ?

Microservice means developing a single, small, meaningful functional feature as single service, each service has it’s own process and communicate with lightweight mechanism, deployed in single or multiple servers.

3. Advantages of microservice architecture ?

Each micro service is small and focused on a specific feature / business requirement.
Microservice can be developed independently by small team of developers (normally 2 to 5 developers).
Microservice is loosely coupled, means services are independent, in terms of development and deployment both.
Microservice can be developed using different programming language (Personally I don’t suggest to do it).
Microservice allows easy and flexible way to integrate automatic deployment with Continuous Integration tools (for e.g: Jenkins, Hudson, bamboo etc..).
The productivity of a new team member will be quick enough.
Microservice is easy to understand, modify and maintain for a developer because separation of code,small team and focused work.
Microservice allows you to take advantage of emerging and latest technologies (framework, programming language , programming practice, etc.).
Microservice has code for business logic only, No mixup with HTML,CSS or other UI component.
Microservice is easy to scale based on demand.
Microservice can deploy on commodity hardware or low / medium configuration servers.
Easy to integrate 3rd party service.
Every microservice has it’s own storage capability but it depends on the project’s requirement, you can have common database like MySQL or Oracle for all services.

4. Disadvantages of microservice architecture ?

Microservice architecture brings a lot of operations overhead.
DevOps Skill required (http://en.wikipedia.org/wiki/DevOps).
Duplication of Effort.
Distributed System is complicated to manage .
Default to trace problem because of distributed deployment.
Complicated to manage whole products when number of services increases.

5. In which case / requirement microservice architecture best fit ?

When you need to support Desktop, web , mobile, Smart TVs, Wearable, etc… or you don’t know in future which kind of devices you need to support.

6. Which products / companies are using Microservie architecture?

Most large scale web sites including Twitter, Netflix, Amazon and eBay have evolved from a monolithic architecture to a microservices architecture.

7. How independent micro services communicate with each other?

It’s depend upon requirement, normally developers use HTTP/REST with JSON or Protobuf (Binary protocol) but are free to use any communication protocol.

8. Why is it that everyone are talking about microservices now?

It’s been nearly 15 years since the concept of Service Oriented Architecture really took hold. With the improvement of RESTful web service and JSON as a data interchange format has made it easier than ever to build easily interconnectable services simply and quickly.

9. Presentation

http://www.infoq.com/presentations/Micro-Services



10. Video





11. Picture: Monolithic vs Modular vs Service oriented architecture







Programming thought of the day:


  • Are you an exception? I bet I can catch you. =)

Friday, May 6, 2016

Spring Framework - MVC Architecture


The Spring web MVC framework provides model-view-controller architecture and ready components that can be used to develop flexible and loosely coupled web applications. The MVC pattern results in separating the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements.
  • The Model encapsulates the application data and in general they will consist of POJO.
  • The View is responsible for rendering the model data and in general it generates HTML output that the client's browser can interpret.
  • The Controller is responsible for processing user requests and building appropriate model and passes it to the view for rendering.

Spring provides a front controller servlet named DispatcherServlet. To build an application, you construct the following components:
  • One or more controllers that invoke business logic and create a ModelAndView object
  • A visualization component such as a JSP
  • XML or annotation configuration to wire the components together
Spring provides various controllers for you to use as base classes for creating your own controllers, depending on your needs. Among them are ones that:
  • Redirect to static views
  • Provide basic servlet-like functionality
  • Process commands
  • Process shared actions
  • Handle forms
  • Provide wizard-like functionality to process multipage forms
If you really want to learn and implement Spring MVC in your Java projects, I recommend you to have you Eclipse IDE ready and watch "Spring MVC Tutorial for Beginners" YouTube video. That tutorial will guide you step by step in a very easy and detailed way. So far, one of the best tutorials.