/avatar.png

Gethin's Blog

Software Architecture Pattern

Application Landscapes

Monolith

  • Advantages
    • Easy to understand,implement,and test
    • Easy deployment
    • Ideal for limited scope
  • Disadvantages
    • Tight coupling
    • Easily leads to complex code
    • One size fit all for every subdomain

N-tier

  • Summary
    • Multiple tiers
    • Tier perform specific task
    • Tiers can be physically separated
    • Tiers aren’t layers
    • Technical boundaries
  • Typical: 3 tier
    • Presentation Tier(UI & pure UI logic)
    • Business Logic Tier(business logic)
    • Data Tier
  • Advantages
    • Independent development
    • Scalability
  • Disadvantages
    • Changes ripple through tiers

Service-Oriented

  • Summary
    • Multiple services
    • Each service is a business activity
    • Service compose-ability
    • Contract standardization
    • Enterprise Service Bus
  • Advantages
    • Services are loosely coupled
    • Scalability
    • No duplication of functionality
  • Disadvantages
    • Reduced agility and team autonomy
    • Costly
    • Many differing views

MicroServices

  • Summary
    • Multiple services
    • Each service is a business activity
    • Teams run the service
    • No logic-heavy enterprise service bus
    • Maximum automate
  • Advantages
    • Services are loosely coupled and easily scalable
    • Increased agility
    • Reliability
    • Designed to handle failures
  • Disadvantages
    • Boundaries not always clear
    • Communication patterns can become complex

Serverless

  • Summary
    • Backend as a service
    • Function as a service

peer-to-peer

  • Summary
    • No central server
    • No constant connection
    • Dynamically discoverable
  • Advantages
    • Share resources
    • Save cost
    • Scaling
  • Disadvantages
    • possible security issues
    • Only for specific scenarios
    • Nontrivial to code

Application Structure Patterns

Layered

  • Summary
    • Presentation(UI)
    • Application(Translation between UI & business)
    • Business(Business logic)
    • Persistence(Code to interact with the database)
    • Data(Data)
  • Advantages
    • well-known among developers
    • Easy to organize
  • Disadvantages
    • Can lead to monolithic applications
    • Need to write lots of code

Microkernel

  • Summary
    • Task scheduler
    • Workflow
    • Data processing
    • Browser
    • Graphic designer
  • Advantages
    • Flexibility
    • Clean separation
    • Separate teams possible
    • Add and remove functionality at runtime
  • Disadvantages
    • Core API might not fit future plugins
    • Can the plugins be trusted
    • Not always clear what belongs in the core

CQRS

  • Summary
    • Command Query Responsibility Segregation
    • 2 models: read/query & write/command
    • Allows for scenario-specific queries
    • Synchronization required
    • Different from event sourcing
  • Advantages
    • Simpler read queries
    • Faster and more scalable read queries
    • Easier to communicate with stakeholders
  • Disadvantages
    • Added complexity
    • Learning curve
    • Possibility of data inconsistencies
    • Eventual consistency

Event sourcing

  • Summary
    • Store events instead of current state
    • Event = something that happened in the past
    • Rehydration or replay
  • Advantages
    • Trace of events
    • Audit trail
    • Business language
    • Event replay
  • Disadvantages
    • Replay and external systems
    • Event structure changes
    • Snapshots

CQRS and Event sourcing combined

  • Summary
    • 2 different concepts
    • Powerful combination
    • It’s not for simple domains, you could start with event sourcing, then add CQRS later.
  • Advantages
    • Simpler and fast queries
    • Scalable
    • Trace of event
    • Audit trail
    • Business language
  • Disadvantages
    • Added complexity
    • Leaning curve
    • Data inconsistencies
    • Event structure change

UI Patterns

MVC

  • Summary
    • Controller
    • Model
    • View
  • Advantages
    • Separation of concerns
    • Parallel development
    • Popular in web frameworks
  • Disadvantages
    • Controllers can become bloated
    • Different definitions

MVP

  • Summary
    • View
    • Presenter
    • Model
  • Advantages
    • Great for desktop application
    • Separation of concerns
    • Testability
  • Disadvantages
    • Presenter can become bloated
    • Desktop application are less popular
    • MVVM Pattern

MVVM

  • Summary
    • View
    • ViewModel
    • Model
  • Advantages
    • Great for modern desktop and mobile applications
    • Separation of concerns
    • Testability
  • Disadvantages
    • Overkill for user interfaces
    • More difficult to debug
    • Desktop applications are less popular

HTTP response status codes

HTTP response status codes

HTTP response status codes indicate whether a specific HTTP request has been successfully completed.

Responses are grouped in five classes:

  • Informational responses (100–199)
  • Successful responses (200–299)
  • Redirects (300–399)
  • Client errors (400–499)
  • Server errors (500–599)

The below status codes are defined by section 10 of RFC 2616. You can find an updated specification in RFC 7231.

If you receive a response that is not in this list, it is a non-standard response, possibly custom to the server’s software.

Information responses

100 Continue

This interim response indicates that everything so far is OK and that the client should continue the request, or ignore the response if the request is already finished.

Third Wedding Anniversary (Museum)

Third Wedding Anniversary (Museum)

Time fly, this is a special day because it is my 3rd wedding anniversary. Last sunday,we went to Shanghai Center Town. Lucky, it is no rain that day. As you know, it is alway rain in Rainy Season in Shanghai.
My wife found a funny place in dazhong dianping (大众点评) app. The place is in 38 floor of Shanghai Center Tower named 宝库匠心馆(3A). Awesome, there are a lot of beautful things. The treasures are very delicate and beautful.

Introduce Microservice & Infrastructure on Cloud

This article will introduce Microservice & Infrastructure on Cloud.

  • Infrastructure on Cloud
    • Iaas & Paas & Saas
    • Virtual Machine & Container
    • Docker & Kubernetes
    • Most Basic Architecture
    • Azure Kubernets Service - AKS

Iaas & Paas & Saas

  • Infrastructure-as-a-service
  • Platform-as-a-service
  • Software-as-a-service

https://www.sherweb.com/blog/cloud-server/what-is-azure-paas/

https://cdn.jsdelivr.net/gh/Gethin1990/gsblogResources/introduce-microservice-infrastructure-on-cloud/Iass_Pass_Saas.png

https://cdn.jsdelivr.net/gh/Gethin1990/gsblogResources/introduce-microservice-infrastructure-on-cloud/Iass_Pass_Saas2.png

Virtual Machine & Container

Virtual Machine: Traditional development & deployment,such as IIS & tomcat

Container:

  1. Platform independence: Build it once, run it anywhere
  2. Resource efficiency and density
  3. Effective isolation and resource sharing
  4. Speed: Start, create, replicate or destroy containers in seconds
  5. Immense and smooth scaling
  6. Operational simplicity
  7. Improved developer productivity and development pipeline
  8. Language independence

Docker & Kubernetes

Docker is the popular way which implement container. Other way ex. Azure Service Fabric, Amazon Elastic Container Service