Our Services
Software Development
Offshore & Outsourcing
Infrastructure
Custom Software Development

menu-services-icon

End-to-end software development tailored to meet all your requirements.

menu-services-icon

AI systems analyze data to help businesses make informed decisions.

menu-services-icon

Crafted custom web solutions to align with our client's business goals.

menu-services-icon

A good mobile app increases brand visibility and ease of customer interaction.

menu-services-icon

A custom-built product sets your business apart with unique features.

menu-services-icon

Empowers confident decision-making and unlocks real AI value with precision.

menu-services-icon

Integrates various business processes into a unified system.

menu-services-icon

Provides real-world insights into how users interact with the product.

menu-services-icon

Accessible from anywhere with an internet connection.

menu-services-icon

Connect systems, automate workflows, and centralize data for faster growth.

menu-services-icon

Upgrade legacy systems with minimal downtime

menu-services-icon

Ensures that core application logic and business processes run smoothly.

menu-services-icon

Creates visually appealing and intuitive interfaces for seamless interactions.

menu-services-icon

Ensures the software meets standards and regulations, avoiding compliance issues.

menu-services-icon

Maintenance protects against vulnerabilities with patches and updates.

Software Development Outsourcing

menu-services-icon

Significant cost savings and access to global talent.

menu-services-icon

Get expert help with technology and industry knowledge for your project.

menu-services-icon

Stay current with industry trends to keep your project competitive.

menu-services-icon

Lets companies focus on marketing, sales, and product development, outsourcing tasks.

IT Services

menu-services-icon

End-to-end IT services that help businesses operate securely, efficiently, and at scale.

menu-services-icon

Speeds up updates and fixes, helping you respond faster to market demands.

menu-services-icon

Offer improved performance and reliability with faster processing and less downtime.

Aspect-Oriented Programming Definition

In computing, aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns.

Cross-cutting concerns are aspects of a program that affect other concerns. These concerns often cannot be cleanly decomposed from the rest of the system in both the design and implementation, and can result in either scattering (code duplication), tangling (significant dependencies between systems).

Examples of concerns that tend to be cross-cutting include:

  • Caching
  • Data validation
  • Logging
  • Format data
  • Transaction processing

Take this scenario as an example:

You develop a service with lots of getter methods to get data from the database and format the result in JSON string.

class Service {
  getUser({id, name}) {
    if (!Number.isInteger(id))
      return null

    const user = DAO.fetch(User, id, name)    return JSON.stringify(user)
  }

  getArticle({id}) {
    if (!Number.isInteger(id))
      return null

    const article = DAO.fetch(Article, id)

    return JSON.stringify(article)
  }

  // getXyz ...
}

The Data Access Object (DAO) can be simplified as:

const DAO = {
  // database access, query and retrieve the results here
  fetch(model, ...params) {
    return new model(...params)
  }
}

And here are your models:

class Article {
  constructor(id) {
    this.id = id
  }
}class User {
  constructor(id, name) {
    this.id = id
    this.name = name
  }
}

As you can see, any getter methods of the Service can be divided by 3 parts (or 3 concerns):

  • Data validation: Check if id is integer.
  • Main concern: Communicate with data access layer.
  • Format data: Convert result to JSON string.

In this example, these 3 concerns are over-simplified. But in real-world applications, the main concern, the data validation, and the format data logics can get very complicated.

The data validation and format data logics are cross-cutting concerns and should be isolated from the main concern because they distract developers from concentrating on the main business logic.

Thus, we should separate and put them in 3 different places:

  • The Service module should only deal with the main concern, or the core business logic.
  • The data validation module should only take care of validating data.
  • The format data module should only take care of formatting data.

► Learn more: https://saigontechnology.com/blog/go-vs-nodejs-the-programming-language-and-a-runtime-environment-differences/

Apply AOP with Javascript

There are many libraries and frameworks that allow us to implement an AOP solution to cope with cross-cutting concerns.

Here, we use a Javascript library: aspect.js

Removing all the cross-cutting concerns from the main concern, we rewrite the Service module as follow:

import {Advised} from 'aspect.js'@Advised()
class Service {
  getUser({id, name}) {
    return DAO.fetch(User, id, name)
  }

  getArticle({id}) {
    return DAO.fetch(Article, id)
  }
}

The @Advised decorator helps wire the ValidateAspect and FormatAspect into the Service class. The implementation of Service is very clean and easy to read. It only focuses on its main responsibility.

Finally, we can try calling some methods to see the result:

const service = new Service()console.log(service.getArticle({id: '1'}))
// nullconsole.log(service.getUser({id: 2, name: 'Hello Kitty'}))
// {"id":2,"name":"Hello Kitty"}

You can clone the full source code here:

https://github.com/blueish9/example-aop-nodejs

Core Concepts of AOP Explained

1/ Aspect

An aspect is a module which has a set of cross-cutting functions.

E.g: ValidateAspect, FormatAspect 

To form an aspect, we define pointcut and advice.

2/ Join point

A join point is a specific point in the application where we can plug-in the AOP aspect. Such as method execution, exception handling, variable modification… Most of the time, a join point represents a method execution.

3/ Advice

An advice is an action taken at a particular join point. In other words, it is the actual code that gets executed before or after the join point.

E.g: @beforeMethod, @afterMethod@aroundMethod

4/ Pointcut

A pointcut is a predicate that matches with join point to determine whether advice needs to run. Depending on the libraries or frameworks, pointcut can be specified differently with pattern or expression.

With the library aspect.js used in this article, a pointcut is specified with Javascript regular expression (Regex):

{
    classNamePattern: /.*/,    
    methodNamePattern: /^(get)/  
}

5/ Target object

A target object is an object being advised by one or more aspects. Also referred to as the advised object.

E.g: The Service class used in the example.

6/ Weaving

Weaving is the process of linking aspects with other objects to create an advised object.

E.g: Apply weaving on the Service class with @Advised decorator.

@Advised()
class Service

A Few Thoughts on AOP

Benefits

  • Embrace modularity.
  • Reduce coupling between dependencies.
  • Make code easier to read, reuse, and maintain.

Drawbacks

  • Not included as part of programming languages, must rely on libraries to work.
  • Debugging can be difficult because code flow is more than meets the eyes.
  • Require disciplines to not overuse.

Aspect-Oriented Programming is considered “dark art” in the OOP world because it can intervene in your code and perform some black magic behind the scene. For example, it can modify your method, replace the result, or even block your code from executing.

Despite all the power it gives, we should use AOP with care and deep understanding. Unnecessary use of AOP in your application can be harmful and may lead to many unexpected errors.

Aspect-Oriented Programming is not an absolute replacement of Object-Oriented Programming. Instead, they are companion.

Aspect-Oriented Programming complements Object-Oriented Programming by providing another way of thinking about program structure. The key unit of modularity in OOP is the class, whereas in AOP the unit of modularity is the aspect.

Sourcehttps://medium.com/@blueish/an-introduction-to-aspect-oriented-programming-5a2988f51ee2

Related articles

Choosing Between Models: A Decision Framework for Tech Leaders
Methodology

Choosing Between Models: A Decision Framework for Tech Leaders

Many companies say they want to “outsource development,” but the needs behind that request are often very different. One company may need a full-time external team for a long product rebuild. Another may need a few developers temporarily to hit a deadline. A third may want a vendor to deliver a fixed-scope MVP. Same word […]
Dedicated Team Pricing in 2026: What Buyers in the US, EU, Australia, and Singapore Actually Budget
Methodology

Dedicated Team Pricing in 2026: What Buyers in the US, EU, Australia, and Singapore Actually Budget

Most pricing guides stop at a broad range, such as “$25 to $80 per hour.” That sounds useful, but in practice, it is not enough to plan a real budget. If you are evaluating a dedicated team in 2026, the better question is not “What is the hourly rate?” but “What does a stable, productive […]
No-Code vs Purpose-Built Software: A Decision Framework for Startup Founders
Methodology

No-Code vs Purpose-Built Software: A Decision Framework for Startup Founders

A practical decision framework for startup founders comparing no-code platforms and purpose-built software. Learn when each approach fits your stage, budget, and goals.
Software RFP Template: Free Guide + Download [2026]
Methodology

Software RFP Template: Free Guide + Download [2026]

A poorly written RFP wastes everyone’s time. You send it out, wait two weeks, and get back vague proposals that are impossible to compare. The problem isn’t the vendors. It’s the RFP itself. A strong software RFP template gives vendors the clarity they need to deliver accurate, comparable proposals. It sets expectations on scope, budget, […]
Cross Functional Team Roles and Responsibilities: A Practical Guide
Methodology

Cross Functional Team Roles and Responsibilities: A Practical Guide

Learn the key cross functional team roles and responsibilities that drive successful collaboration. Practical guide with role breakdowns and best practices.
Software Pricing Models: A Complete Guide (2026)
Methodology

Software Pricing Models: A Complete Guide (2026)

Choosing a software pricing model is more than setting a price tag. It is a strategic move that affects revenue, churn, and growth. In 2026, leading companies treat it as something that evolves with market trends and the broader competitive landscape. Key Takeaways Pricing is a growth lever, not just a number. The best software […]
Software Development Contracts: Controlling Cost, Change, and Risk (2026)
Methodology

Software Development Contracts: Controlling Cost, Change, and Risk (2026)

A software development contract is not just a legal document. It is a decision framework that controls cost, risk, and accountability when software inevitably changes. After reviewing and negotiating dozens of software development contracts across fixed price, time & materials, and dedicated team models, one pattern is clear. Most disputes come from unclear assumptions, not […]
PoC vs Prototype vs MVP: What Is The Difference?
Methodology

PoC vs Prototype vs MVP: What Is The Difference?

Saigon Technology defines three stages: proof of concept, prototype, and minimal viable product. Understand PoC vs MVP vs prototype to ensure clear goals.
Expert Guide on Outsourcing to Vietnam
Methodology

Expert Guide on Outsourcing to Vietnam

Explore why outsourcing to Vietnam helps balance cost and quality. Partner with trusted vendors like Saigon Technology to gain a competitive edge!

Want to stay updated on industry trends for your project?

We're here to support you. Reach out to us now.
Contact Message Box
Back2Top