A Comparative Study: Object-Oriented and Aspect-Oriented Programming

Verified

Added on  2020/05/28

|15
|3136
|416
Report
AI Summary
This report provides a comprehensive comparison between Object-Oriented Software Development (OOSD) and Aspect-Oriented Programming (AOP). It begins with an executive summary outlining the report's key aspects, including a literature review of both programming paradigms. The discussion section delves into the core concepts of each approach, highlighting their strengths and weaknesses. A detailed comparative analysis is presented, examining the differences in coding practices and methodologies. The report also includes a discussion on the advantages and disadvantages of each approach, providing real-world examples. The conclusion summarizes the key findings and offers recommendations for selecting the appropriate programming language based on project requirements. References are provided for further research and exploration of the topics discussed.
Document Page
Running head: COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
Comparison between OOSD and Aspect oriented software development
Name of the student
Name of the University
Author Note
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1
COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
Executive summary
This report discusses about the major concepts included in both the aspect oriented programming
and the object oriented programming. The chosen country is United Kingdom. This report also
includes a literature review of both the programming languages. In addition, the report also
includes a comparative analysis among the aspect oriented and the object oriented programming.
Moreover, the difference in coding practices is also discussed in this report. Lastly, this report
concludes by listing the recommendations that can be considered when choosing the aspect
oriented programming language.
Document Page
2
COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
Table of Contents
Introduction......................................................................................................................................3
Discussion........................................................................................................................................3
Literature review..........................................................................................................................3
Comparison among OOSD and AOP..........................................................................................5
Conclusion.....................................................................................................................................11
Recommendation...........................................................................................................................12
References......................................................................................................................................13
Document Page
3
COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
Introduction
Software development is a process which is adopted for the development of a software
project. This is mainly done by implementing the programming languages for the development
of software and implementing it in the company standards. The use of object oriented
programming is mostly done because of its aid in the process of software engineering process.
This is mainly because the object oriented model suits the domain related problems. However,
the use of object oriented programming cannot capture the processes effectively and this is the
reason for adopting the use of aspect of oriented programming language. This report includes a
comparison among both the programming languages. In addition, the results from this analysis
are also discussed in this report. Lastly, the literature review of the languages is also mentioned
in this report.
Discussion
This section discusses about the main concepts related to the topic.
Literature review
The design of software process is done by breaking it into smaller components which are
then addressed to individually. Using these processes, a programmer can apply coding
techniques to each of the subsystems and then combine them by applying the process of
abstraction. When abstraction and composition techniques are used, then the programming
techniques are greatly combined (Aspect-Oriented Programming, 1997). For this reason, the use
of procedural languages, structured languages and the object oriented languages are being used
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4
COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
for the process as the software development as all of the languages have the basics of
abstractions and compositions in their features.
Object oriented programming
The use of the OOP language goes back to the early centuries where the Simula language
was famous for program simulations. In the modern times, the use of C++ and Java is the most
adopted languages for programming. In case of the object oriented programming languages,
objects are made which communicates among each other in the domain (Jackson 2016). The
encapsulation is a feature of the OOP which converts the whole codes into small modules which
can then be re-used. Using of classes and applying for inheritance is another feature of the object
oriented programming languages.
However, the mapping of objects to the relational database is a great technical problem
that is considered in the use of OOP language (Smith 2015). The use of application servers are a
wise choice for addressing to the transactional details of a database server. In addition, the use of
business logic software must be used for adopting business details. Similarly, object oriented
development is usually accompanied by object oriented modeling which considers the
conceptual designs at high level to implementations at lower levels. The modeling of these
concepts both in the high level and the low level terms are done by using UML languages
(Corral et al. 2014). The major advantages of OOP are that it allows extensive reuse of codes and
better abstraction and encapsulation.
Aspect oriented programming
The use of traditional approaches cannot be used for constructing complex systems. This
is because the exact codes are cut across due to execution processes. This means that the
Document Page
5
COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
modules of the program become intangible with each other which lead to failure (Cardoso et al.
2016). For this reason, the use of aspect oriented programming is emphasized as it is always
involved with the aspects rather than codes. The main purpose of the aspect oriented
programming includes removal of the tangible nature of the aspects and then combining those
aspects and with codes by using automated tools.
Additionally, the use of abstraction is mainly done to break down the complex problems
by using the method of aspect decomposition. This means that the software codes are present in
the whole class as aspects which are usually spread out across the whole program (Pasquier,
Bacon and Shand 2014). This greatly enables decoupling of the aspects. Thus, it can be said that
modifications can be done without causing changes in the code.
The use of aspect orientation is also done in the place of software development
programming. It makes it necessary for considering the architecture of the software by following
the aspect angle (Ghareb and Allen 2015). However, the software architecture and the aspect
orientation are two different subjects which cause various problems. The main reason for such
outcome is that it is very difficult to handle different aspects and it takes different treatments for
referencing them.
Comparison among OOSD and AOP
Aspect oriented programming assists in providing solution to the previous issue. It deals
with aspects and behavior that cuts through several objects. One of the main limitations to
object oriented programming includes specific things that can crosscut specific objects as well as
methods. One of the examples is logging or monitoring (Uysal 2016). In OOP, it is required to
Document Page
6
COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
login in to each of the classes. AOP avoids the process through treating the process cross cutting
behavior that is opposed to the object. A single block of code helps to deal with specific aspect.
On the other hand, a class is considered as blueprint for doing something such as engine,
employee and publication. An object is considered as an example of the class. A class can inherit
specific methods as well as variables from different class. It is considered as inheritance. It is
possible to develop a particular program with fairly complicated hierarchy of the classes
(Nanakorn, Petprakob and Naga 2014). However, there is a limitation where it is important to
protect data as well as variables within the particular class. The log files are required radio access
to engine. However, the term is defined is the type of data hiding or data protection that is named
as encapsulation.
For an image processing system, the main concept involves passing of various images
through a point. For this reason, the memory addressing and the storage requirements must be
taken into considerations (Aspect-Oriented Programming, 1997). The basic functionality of the
system involves the passage of various images as input and the production of an output image.
The basic filters used in this system can be defined by using various primitive procedures which
provides logical and pixel-wise outputs. This will be done by starting loops in the process. This
is the main comparison among the two languages. In case of the OOP, the loops and the
processes are done differently giving the concept of object orientation.
The next comparison lies in the process of logical operations. The use of the operator ‘!’
is done for recognizing the symbols in the program while in case of the object oriented
programming languages, it defines the not operation in execution (Greifenberg et al. 2015).
Another comparison among the two approaches is the use of syntax functions like “defun”.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7
COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
However, the simple implementation of the AOP cannot define the memory optimization
problems. For each procedure, the number of loops covered identifies each of the inputs and
creates an output significantly. The output images that have been produced exist for a small
amount of time. After that they are customized by another executable loop (Aspect-Oriented
Programming, 1997). This results in reference memory exhaustion and in turn leads to cache
memory miss and performance reduction. The solution for this is to consider global perspectives
of the program codes and mapping of the intermediate results so that memory allocations are not
done for them. This mainly utilizes the fusion of the loops which is responsible for the creation
of the output.
(defun horizontal-edge! (a)
(let ((result (new-image))
(a-up (up! a))
(a-down (down! a)))
(loop for i from 1 to width do
(loop for j from 1 to height do
(set-pixel result i j
(or (and (get-pixel a i j)
(not (get-pixel a-up i j)))
(and (get-pixel a i j)
Document Page
8
COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
(not (get-pixel a-down i j)))))))
result))
Similarly, the memory allocation processes of object oriented programming is also
similar but with a different perspective included in processing. In case of object oriented
programming languages like Java, the use of default constructors are in place for memory
addressing. The constructors are in place for repeated usages (Barnes, Kölling and Gosling
2017). This means a particular code used for constant memory requirements will be used each
and every time a class is executable. This reduces the memory usages and in turn leads to
effective memory allocations.
class Programming {
Programming() {
System.out.println("Constructor method called.");
}
public static void main(String[] args) {
Programming object = new Programming();
}
}
In case of the object oriented programming, the major features include encapsulation,
abstraction, inheritance and polymorphism (Welborn et al. 2014). However, in case of aspect
Document Page
9
COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
oriented programming, the use of join points, advice, pointcut and introduction is present. For a
program code listed below, the aspect orientation will be discussed.
public class TestClass {
public void sayHello () {
System.out.println ("Hello, AOP");
}
public void sayAnyThing (String s) {
System.out.println (s);
}
public static void main (String[] args) {
sayHello ();
sayAnyThing ("ok");
}
}
For this code, the aspect orientation will change the listings of the codes.
public aspect MyAspect {
public pointcut sayMethodCall (): call (public void
TestClass.say*() );
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
10
COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
public pointcut sayMethodCallArg (String str): call
(public void TestClass.sayAnyThing (String))
&& args(str);
before(): sayMethodCall() {
System.out.println("\n TestClass." + thisJoinPointStaticPart.getSignature().getName() +
"start..." );
}
after(): sayMethodCall() {
System.out.println("\n TestClass." + thisJoinPointStaticPart.getSignature().getName() + "
end...");
}
before(String str): sayMethodCallArg(str) {
if (str .length() < 3) {
System.out.println ("Error: I can't say words less than 3
characters");
return;
}
}
Document Page
11
COMPARISON BETWEEN OOSD AND ASPECT ORIENTED SOFTWARE
DEVELOPMENT
}
The first line of the code defines the aspect in a similar way of defining codes in object
oriented languages like Java. The aspect oriented languages consists of methods and member
variables. Additionally, it also includes advices, pointcuts and introductions. In the second and
third line, the modification will be considered. This line represents the pointcuts. The join points
in an aspect program are used to define points considered in case of execution of a program code
(Mammar, Nguyen and Laleau 2017). This is done by calling out the TestClass.sayAnyThing
and TestClass.sayHello methods. The join points include method calling, execution, field get and
set, exception handling and static/dynamic initialization. The pointcut is considered as a
language construct that selects join points according to set criteria which can be function names
or wildcards.
The pointcuts are used for defining an advice. The uses of an advice involve defining
additional codes for execution. In the above program, the lines from 4 to 6 and 7 to 9 is used to
define two advices which will be executed after the first occurrence of the pointcut. The dynamic
execution of an aspect is done by utilizing pointcuts and advice (Tanter, Figueroa and Tabareau
2014). However, the use of introduction in an aspect is adopted for customizing the static stature
of a code. New methods and variables can be added to a class by an aspect utilizing the
introduction. Moreover, implementing of an interface and handling of exceptions can also be
done by utilizing the introduction.
Conclusion
Thus, it can be stated that the use of aspect oriented programming is greatly used to
enhance the program codes. For an object oriented programming language, the breaking of the
chevron_up_icon
1 out of 15
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]