Register Login
Internet / AI Technology University (ITU/AITU)





|

Top Links: >> 80. Technology >> Internet Technology Summit Program >> 1. Java Introduction >> 1.3. Critical Thinking and Software Development Process >> 1.3.2. SDLC-SOA-AOP
Current Topic: 1.3.2.3. OOP versus Aspect-Oriented and Functional Programming
Sub-Topics: 1.3.2.3.1. AOP Samples
-- Scroll to check for more content below...
You have a privilege to create a quiz (QnA) related to this subject and obtain creativity score...
OOP versus Aspect-Oriented and Functional Programming

The greatest scientist of all times, Archimedes, defined our world as a sequence of events.

Another famous Greek, Democritus, insisted that the world consists of matter objects, with the smallest called atoms.

Sounds like an argument between functional and object-oriented approach, right?

Object-Oriented Programming (OOP) focuses on objects. OO programmer spends time modeling a development task in objects, which have similar structure and behavior. This upfront planning is a significant part of OO design. Miscalculations in initial analysis can cause great problems in implementation.

Yes, OOP has its trade-offs.

Strong data typing allows compiler to prevent run-time crashes due type mismatch. That is good! But apparently not always. There are cases when developers prefer “generics”.

With all due respect to objects, there are common concerns, such as security, that go across many objects. There are common aspects, such as querying databases, which can be more efficiently expressed by non-OOP languages. Of course, Object-Relational Mapping (ORM) is kind of solving this problem. But ORM requires resources and slows down performance.
Creating objects is expensive! And although memory and disk space is almost free, these limitations might be significant for mobile and micro devices.

Overall OOP makes sense as a well-known development paradigm, understood and helpful in teamwork, which saves expenses on the most expensive factor of development, developers!

OOP is the mainstream of development, but it is not the only way of thinking.

Aspect-Oriented Programming

Aspect-Oriented Programming (AOP) complements Object-Oriented Programming focusing on common aspects. Not a class, but an aspect or a concern is the key unit in AOP. Transaction management can serve as an example of a crosscutting aspect for multiple types and objects.

The ideas of AOP can be expressed with its own language, such as AspectJ, or implemented in Java, for example, by the Spring framework.

*AOP has its own vocabulary that is commonly used in AspectJ and Spring:

Aspect: a concern that cuts across multiple classes. In Spring AOP, aspects are implemented with regular (the schema-based approach) or annotated classes (the @AspectJ style).
Join point: a point during the execution of a program, such as the execution of a method or the handling of an exception. In Spring AOP, a join point always represents a method execution.
Advice: action taken by an aspect at a particular join point. Different types of advice include "around," "before" and "after" advice. (Advice types are discussed below.) Many AOP frameworks, including Spring, model an advice as an interceptor, maintaining a chain of interceptors around the join point. A similar model is in Jva Servlet Filters, the methods, which can be called before or after the Servlet invocation.
Pointcut: a predicate that matches join points. Advice is associated with a pointcut expression and runs at any join point matched by the pointcut (for example, the execution of a method with a certain name). The concept of join points as matched by pointcut expressions is central to AOP, and Spring uses the AspectJ pointcut expression language by default.
Was it clear so far? Highlight the text in question Or

Introduction: declaring additional methods or fields on behalf of a type. Spring AOP allows you to introduce new interfaces (and a corresponding implementation) to any advised object. For example, you could use an introduction to make a bean implement an IsModified interface, to simplify caching. (An introduction is known as an inter-type declaration in the AspectJ community.)
Target object: object being advised by one or more aspects. Also referred to as the advised object. Since Spring AOP is implemented using runtime proxies, this object will always be a proxied object.
AOP proxy: an object created by the AOP framework in order to implement the aspect contracts (advise method executions and so on). In the Spring Framework, an AOP proxy will be a JDK dynamic proxy or a CGLIB proxy.
Weaving: linking aspects with other application types or objects to create an advised object. This can be done at compile time (using the AspectJ compiler, for example), load time, or at runtime. Spring AOP, like other pure Java AOP frameworks, performs weaving at runtime.

*Read a complete Spring AOP Reference: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html

Functional Programming
Another complementary way of programming is functional programming.

Functional programming (FP) makes it easier to write parallel code for multiprocessors. Instead of mutable variables and loops FP provides powerful ways defining and composing functions.

The best example of FP implementation can be Scala, the language that combines functional and object-oriented programming. Scala works with Java and its tools and is used in many open source projects and companies. Twitter, LinkedIn, Foursquare, Tumblr, and more popular web sites are programmed with Scala.
This is a simple code sample that in three lines will reverse the sequence of words and sequence of characters in the words.

for(i<-List("olleH", " ", "!dlrow")){
print(i.reverse)
}


The result is a familiar sentence: Hello World!

Assignments:

1. Check an example of Spring AOP CustomerService: http://www.mkyong.com/spring/spring-aop-examples-advice/
2. Read more about Scala in the Tutorial: http://docs.scala-lang.org/tutorials/scala-for-java-programmers.html
3. Create 2 QnA related to the AOP and 2 QnA for Functional Programming section, each with the following format where the first answer is correct and two other answers are wrong.
Question:
Answer:
Answer:
Answer:

4. Email the QnAs to dean@ituniversity.us
Questions and Answers (QnA): QnA1 | QnA2 | QnA3 | QnA4 | QnA5 | QnA6 | QnA7 | QnA8 | QnA9 | QnA10 | QnA11 | QnA12 | QnA13 | QnA14 | QnA15 | QnA16 | QnA17 | QnA18 | QnA19
We offer a fun way to share your experience and be rewarded.
You create a puzzle - quiz with a good question and several answers, one correct and several wrong ones.
The question as well as answers can include text, links, video.
This is your creation, completely up to your taste, humor, and of course your knowledge.
If there is an existing quiz above, you need first to solve the puzzles and evaluate the quality (at the bottom of every quiz).
After finishing the existing quiz you will be able to create your own. The best puzzles will be rewarded!
We invite you to create your own questions and answers (QnA) to increase your rank and win the Top Creativity Prize!

Topic Graph | Check Your Progress | Propose QnA | Have a question or comments for open discussion?
<br/>for(i<-List("olleH", " ", "!dlrow")){
<br/>  print(i.reverse)
<br/>}
<br/>


The result is a familiar sentence: Hello World!

Assignments:

1. Check an example of Spring AOP CustomerService: http://www.mkyong.com/spring/spring-aop-examples-advice/
2. Read more about Scala in the Tutorial: http://docs.scala-lang.org/tutorials/scala-for-java-programmers.html
3. Create 2 QnA related to the AOP and 2 QnA for Functional Programming section, each with the following format where the first answer is correct and two other answers are wrong.
Question:
Answer:
Answer:
Answer:

4. Email the QnAs to dean@ituniversity.us
Questions and Answers (QnA): QnA1 | QnA2 | QnA3 | QnA4 | QnA5 | QnA6 | QnA7 | QnA8 | QnA9 | QnA10 | QnA11 | QnA12 | QnA13 | QnA14 | QnA15 | QnA16 | QnA17 | QnA18 | QnA19

We offer a fun way to share your experience and be rewarded.
You create a puzzle - quiz with a good question and several answers, one correct and several wrong ones.
The question as well as answers can include text, links, video.
This is your creation, completely up to your taste, humor, and of course your knowledge.
If there is an existing quiz above, you need first to solve the puzzles and evaluate the quality (at the bottom of every quiz).
After finishing the existing quiz you will be able to create your own. The best puzzles will be rewarded!

We invite you to create your own questions and answers (QnA) to increase your rank and win the Top Creativity Prize!


Topic Graph | Check Your Progress | Propose QnA | Have a question or comments for open discussion?

Have a suggestion? - shoot an email
Looking for something special? - Talk to AI
Read: IT of the future: AI and Semantic Cloud Architecture | Fixing Education
Do you want to move from theory to practice and become a magician? Learn and work with us at Internet Technology University (ITU) - JavaSchool.com.

Technology that we offer and How this works: English | Spanish | Russian | French

Internet Technology University | JavaSchool.com | Copyrights © Since 1997 | All Rights Reserved
Patents: US10956676, US7032006, US7774751, US7966093, US8051026, US8863234
Including conversational semantic decision support systems (CSDS) and bringing us closer to The message from 2040
Privacy Policy