File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Aspect vs Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Aspect vs Objects" Watch "Aspect vs Objects" New topic

Aspect vs Objects

Sunderam Goplalan
Ranch Hand

Joined: Oct 10, 2011
Posts: 86
Hi Matt,

Recently I've started liking Aspect oriented programming. I use Spring framework based off of Java and Spring solves some of the cross cutting concerns of business applications using Aspects in a less intrusive way.
Aspects, like objects in OO world, also aid in achieving modularity.

How would you compare Aspects with Objects?

G Sunderam

SCJP 5.0 , SCEA Java EE 5, TOGAF Certified
Matt Weisfeld

Joined: May 01, 2013
Posts: 24
This is an interesting topic. Your question may fit well with an earlier thread on separating behaviors in classes. For example, you can use a hierarchy of birds. When you ask people to describe the most common behavior of birds almost everyone would say 'flight". However, not all birds fly. So you would have to decide if you want to create a Bird class that doesn't include a "flight" method. Perhaps you would need 2 classes, FlyingBirds and FlightLessBirds that inherits from the Bird class. There really is no right or wrong way to handle the design - it just makes for interesting discussions. Not all dogs can bark either. Aspects may allow a different approach to thye design. Is this what you were thinking?

Matt Weisfeld
Sunderam Goplalan
Ranch Hand

Joined: Oct 10, 2011
Posts: 86
Yes. Thanks. In this example though, Objects seem to fit the bill. As you said, in other scenarios/contexts, Aspects can be leveraged.
I agree. Here's the link:
subject: Aspect vs Objects
It's not a secret anymore!