Skip to content
Aasim's Web Corner
Aasim's Web Corner

Ink is better than the best memory.

  • Odysseys & Artistry
    • Saunterer Soul
    • My Poetry
    • My Sketch Work
  • Project Management
    • Agile & Frameworks
    • PMP Certification
  • Digital Diary
    • History
    • Islam
    • Life Around Us
    • My Bookshelf
  • My Tutorials
    • Amazon Kindle
    • Android
    • Aspect Oriented Programming
    • BlackBerry
    • Code Repositories
    • iOS
    • Java
    • JavaScript
    • Linux
    • Random Tips
Connect with me
Aasim's Web Corner

Ink is better than the best memory.

AOP - Part 3 - AasimNasem.com

Aspect Oriented Programming Tutorial (Part-3)

Aasim Naseem, January 1, 2010 | Read Count: 15,406April 9, 2025
Category: My Tutorials > Aspect Oriented Programming

Hello All.

hope that everything is going best in your life.

This is a third part of my tutorial on topic of Aspect Oriented Programming … its too late .. i know … a month or more!! … second part was posted  i think 35 40 days back … and after that i got too much busy in some projects … plus my notebook had some problem with display hardware. Though i have composed this part many days back but final draft wasn’t compliled till today …. the thread of black berry application tutorial is also waiting for next part … seems i’m too much lazy …

Anyhow.. here are some more concepts regarding AOP. Due to shortage of time i will not include programing example today … the next part will cover all previous theory with practical examples … today just grasp few more concepts …

In this part, you will know some of basic terms/concepts that are core of AOP. You have to keep these things in considerations while building your application with AOP. let have a look over them …

Aspects

in very black-box definition, aspects in AOP are like classes in OOP. we put all the code that has scattered across the application in single unit call aspect, or in other words we express cross-cutting concerns in stand-alone modules called aspect (first benefit of AOP that it collects all scattered or tangled code across the application in form of cross cutting concerns and put them in separate units). For example, as we discussed in last part, logging code can cross-cut many modules, yet the aspect of logging should be separate from the functional concerns of the module where logging code was written. Aspects are similar to classes in their declaration, and they define types, just as classes do. In addition to its declaration, aspects contains both point-cuts and advice. We will define these two concerns in next sections.

Joint Points

A join point could be any point in the flow of your program. As name depicts this is a point in our application or source code where our program and aspect meet each other. or in other worlds, this is the point where AOP play its role. Join points represent well-defined points in a program’s execution that could be any method/constructor calls, method/constructor execution, field get and set, exception handler execution and/or static and dynamic initialization. You told your compiler via joint points that at this point inject the code from aspects and make final executable program.

Advices

Advices holds those piece of codes that actually executes when AOP play its role in our program. It may contain code that scattered across the application. Advice is a piece of code that we inject in our program when a join point is reached. You define advice relative to a point-cut like advices can executes before, after, or around a join point. It is an additional code that runs along with execution of our running program.

Again talk about logging.It is a concern that cross cut across the application, means same code for logging can be found in various modules of application. To understand the concept of advices, just think that we first define joint points in our application where we need logging. it means we find those methods where same logging code is present. secondly we put all logging code (infact same piece of code) in separate pieces of code called “advice” and then while compilation of our program, compiler inject advice’s code when its join point is reached. By doing that we picked all occurrence of same piece of code and put it in separate entity.

Don’t be confuse between advice and aspect. To understand the difference just think aspect like class and advice as any method in that class. got it …. !!!!

Point cut

Simply a pointcut is a set of join points. Whenever the program execution reaches one of the join points described in the pointcut, a piece of code associated with the pointcut (called advice) is executed. This allows a programmer to describe where and when additional code should be executed in addition to an already defined behavior. This permits the addition of aspects to existing software.

Introduction

I love this feature of AOP. Believe me if you get real soul of this, you will become fan of AOP, like i’m. Introduction allows aspects to modify the static structure of a program. By using introduction, aspects can add new methods and variables to a class, declare that a class implements an interface, or convert checked to unchecked exceptions. To understand what we can get by using Introductions, consider the following real life scenario.

In every institute, student has to pay their fee as monthly or semester basis. A student gets its fee slip form accounts branch and submits it in bank and get receipt. His/her  account file has been updated with copy of fee receipt. Thats looks fine in such scenario.

What if a student unable to submit his/her fee till dead line??? he/she has to submit a request form for granting him extension in fee submission or even for allowing him/her to submit his late fee.  In such case accounts branch will issue him an separate fee slip mentioning late fee fine. He/she will submit his late fee and will get fee receipt. In his record, few additional documents will be filed .i.e. application for allowing late fee, a late fee submission receipt, some other documents (like medical certificate etc) to prove why he/she was unable to submit fee within time.

In both cases, different kind of data was filed though the process was same .i.e. submitting fee.

Now let try to automate this scenario as a software module. You need to create a class having basic attributes related to fee like paymentDate, amount. The rest of the attribute that you need to track late fee submission will be stored in an aspect. Incase of any late fee case, the aspect will inject (or introduce) additional variable/methods into existing class so that you can store and retrieve information as per scenario. Remember that class structure will not change, just a new version or object will have some additional attribute. Hence different objects of same class may have different kind of attribute due to introduction feature of aspects.

Aspect Weaver

It weave our aspect and other business logic into single/final executable program. It works at compilation level of source code. How does it work is beyond the discussion of this tutorial. I will write a short note about its core functionality later on. Right now just think with AOP, we start by implementing our project using our OO language (for example, Java, or C++ ), and then we deal separately with crosscutting concerns in our code by implementing aspects. Finally, both the code and aspects are combined into a final executable form using an aspect weaver. As a result, a single aspect can contribute to the implementation of a number of methods, modules, or objects, increasing both reusability and maintainability of the code. We just define join-points, point-cuts, advices and aspects along with our business logic of program and then aspect weaver merge (infact weave) these things in our source code at compilation time.

in conventional way, our source code is simply compiled by language compiler and produce final executable code.

Aspect Weaver first weave your aspects, point-cuts, join-points, advices into our source code and make final script of code that will be ready to be compiled by language compiler, hence producing executable program containing our business logic along with AOP features.

free counters

Author Profile

Aasim Naseem
Hey, Thanks for your interest. I’m a PMP, AWS Solutions Architect, and Scrum Master certified professional with 17+ years of hands-on experience leading projects, building teams, and helping organizations deliver software solutions better, faster, and smarter.

Outside of work, I’ve got a deep curiosity for history — especially ancient civilizations like Egypt. I also enjoy reflecting on the everyday moments that shape how we live and work. This blog is my space to share insights, lessons, and thoughts from both my professional journey and personal interests.

Thanks for reading — and I hope you will find something here that matches your interest.
Latest entries
  • Economic impact of Eid ul Adha - AasimNaseem.comIslamJune 6, 2025 | Read Count: 282Economic impact of Eid-ul-Adha
  • Best PMP Exam Study Resources - AasimNaseem.comPMP CertificationMay 23, 2025 | Read Count: 493Best PMP Study Resources for 2025 (Books, Courses, Tools & More)
  • agile vs scrum - AasimNaseem.comAgile & FrameworksMay 7, 2025 | Read Count: 463Agile vs Scrum: Finally Understanding the Difference
  • When Agile shouldn’t Use - AasimNaseem.comAgile & FrameworksApril 25, 2025 | Read Count: 493When Not To Use Agile: 5 Signs You Need a Different Approach
Aspect Oriented Programming AdvicesAspect Oriented Programming TutorialAspect Oriented Programming Tutorial (Part-3)Aspect WeaverAspectsJoint PointsPoint Cuts

Post navigation

Previous post
Next post

Related Posts

Aspect Oriented Programming AOP - Part 1 - AasimNasem.com

Aspect Oriented Programming (Part-1)

October 27, 2009 | Read Count: 16,443April 9, 2025

Category: My Tutorials > Aspect Oriented ProgrammingHello Everyone. Hope you are doing best in all aspects of your life. Today, I’m going to start new series of tutorials on new topic .i.e. Aspect Oriented Programming, in which you will learn about new programming paradigm (though it’s too old), its basics,…

Read More
Aspect Oriented Programming AOP - Part 2 - AasimNasem.com

Aspect Oriented Programming Tutorial :: Core Concept (Part-2)

November 4, 2009 | Read Count: 16,450April 9, 2025

Category: My Tutorials > Aspect Oriented ProgrammingHello All. Hope that you all are doing best in all aspects of your life… This is a second part of tutorial on aspect oriented programming. In last part, we discussed little about object oriented approach to design and develop computer based system and…

Read More

Comments (4)

  1. Kanaka Chalam Volety says:
    February 18, 2010 at 7:16 pm

    Hi Ans…..you have a wonderful writing style….I really enjoyed reading your 3 parts in just 1 sitting and everything went inside my head easily, I really appreciate how nicely you have explained the concepts.
    I am looking forward to a part 4

    Thank you very much

    Reply
    1. Ans says:
      February 18, 2010 at 7:37 pm

      @ kanaka
      thank you very much to find this much time for reading my tutorial … just little bit busy in some project else i will definitely post its next part. thanks again and please give your kind suggestions to make it more better.

      Reply
  2. kamran says:
    March 31, 2010 at 7:28 am

    u r too much lazy .. where is next part … m waiting bro …

    Reply
  3. saiful103a says:
    March 16, 2011 at 2:36 am

    have read all three tutorial’s.Though i have heard about the term but never consider to dig it.After reading your blog i really got the concept of AOP.it would be really great to see some programming example.
    and thanks for an excellent tutorial. 🙂

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Economic impact of Eid-ul-Adha
    Economic impact of Eid-ul-Adha
    June 6, 2025 | Read Count: 282
  • Best PMP Study Resources for 2025 (Books, Courses, Tools & More)
    Best PMP Study Resources for 2025 (Books, Courses, Tools & More)
    May 23, 2025 | Read Count: 493
  • Agile vs Scrum: Finally Understanding the Difference
    Agile vs Scrum: Finally Understanding the Difference
    May 7, 2025 | Read Count: 463
  • When Not To Use Agile: 5 Signs You Need a Different Approach
    When Not To Use Agile: 5 Signs You Need a Different Approach
    April 25, 2025 | Read Count: 493
  • Quran on Peace and Kindness
    Quran on Peace and Kindness
    April 20, 2025 | Read Count: 452

Posts from Past

  • June 2025
  • May 2025
  • April 2025
  • January 2025
  • November 2024
  • April 2024
  • October 2022
  • August 2021
  • September 2020
  • May 2020
  • April 2019
  • January 2019
  • September 2018
  • July 2015
  • June 2015
  • November 2014
  • September 2014
  • April 2014
  • June 2013
  • May 2013
  • February 2013
  • January 2013
  • December 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • March 2012
  • February 2012
  • January 2012
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009

Categories List

  • Agile & Frameworks
  • Amazon Kindle
  • Android
  • Aspect Oriented Programming
  • BlackBerry
  • Blog
  • Code Repositories
  • History
  • iOS
  • Islam
  • Java
  • JavaScript
  • Life Around Us
  • Linux
  • My Bookshelf
  • My Poetry
  • My Sketch Work
  • PMP Certification
  • Random Tips
  • Saunterer Soul

Recent Posts

  • Economic impact of Eid-ul-Adha
  • Best PMP Study Resources for 2025 (Books, Courses, Tools & More)
  • Agile vs Scrum: Finally Understanding the Difference
  • When Not To Use Agile: 5 Signs You Need a Different Approach
  • Quran on Peace and Kindness

Recent Comments

  1. Aasim Naseem on When Not To Use Agile: 5 Signs You Need a Different Approach
  2. Aasim Naseem on When Not To Use Agile: 5 Signs You Need a Different Approach
  3. Masjid Wazir Khan, Lahore Pakistan - Aasim's Web Corner on Everlasting Art of Badshahi Masjid Lahore Pakistan
  4. Rishi Kumar on When Not To Use Agile: 5 Signs You Need a Different Approach
  5. Best PMP Study Resources for 2025 (Books, Courses, Tools & More) - Aasim's Web Corner on PMP Exam Eligibility 2025: 3 Things You Need to Know
©2025 Aasim's Web Corner | WordPress Theme by SuperbThemes