Sunday, November 28, 2010

Aspect Oriented Programming...


It is found, many programming problems for which neither procedural nor object-oriented programming techniques are sufficient to clearly capture some of the important design decisions the program must implement.

Object-oriented programming (OOP) has been presented as a technology that can fundamentally aid software engineering, because the underlying object model provides a better fit with real domain problems. But we have found many programming problems where OOP techniques are not sufficient to clearly capture all the important design decisions the program must implement. Instead, it seems that there are some programming problems that fit neither the OOP approach nor the procedural approach it replaces.

Aspect-oriented programming entails breaking down program logic into distinct parts (so-called concerns, cohesive areas of functionality). All programming paradigms support some level of grouping and encapsulation of concerns into separate, independent entities by providing abstractions (e.g. procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. But some concerns defy these forms of implementation and are called crosscutting concerns because they "cut across" multiple abstractions in a program.

Aspect-Oriented Programming (AOP) complements OO programming by allowing the developer to dynamically modify the static OO model to create a system that can grow to meet new requirements. Just as objects in the real world can change their states during their lifecycles, an application can adopt new characteristics as it develops.

Features of AOP:

1.    Cross-cutting concerns: Even though most classes in an OO model will perform a single, specific function, they often share common, secondary requirements with other classes. For example, we may want to add logging to classes within the data-access layer and also to classes in the UI layer whenever a thread enters or exits a method. Even though the primary functionality of each class is very different, the code needed to perform the secondary functionality is often identical.

2.    Advice: This is the additional code that you want to apply to your existing model. In our example, this is the logging code that we want to apply whenever the thread enters or exits a method.

3.    Point-cut: This is the term given to the point of execution in the application at which cross-cutting concern needs to be applied. In our example, a point-cut is reached when the thread enters a method, and another point-cut is reached when the thread exits the method.

4.    Aspect: The combination of the point-cut and the advice is termed an aspect. In the example below, we add a logging aspect to our application by defining a point-cut and giving the correct advice.

5.    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.

6.    AOP proxy: an object created by the AOP framework in order to implement the aspect contracts (advises method executions and so on). In the Spring Framework, an AOP proxy will be a JDK dynamic proxy or a CGLIB proxy.

7.    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.

When thinking of an object and its relationship to other objects we often think in terms of inheritance. We define some abstract class; let us use a Dog class as an example. As we identify similar classes but with unique behaviors of their own, we often use inheritance to extend the functionality. For instance, if we identified a Poodle we could say a Poodle Is A Dog, so Poodle inherits Dog. So far so good, but what happens when we define another unique behavior later on that we label as an Obedient Dog? Surely not all Dogs are obedient, so the Dog class cannot contain the obedience behavior. Furthermore, if we were to create an Obedient Dog class that inherited from Dog, then where would a Poodle fit in that hierarchy? A Poodle is A Dog, but a Poodle may or may not be obedient; does Poodle, then, inherit from Dog, or does Poodle inherit from Obedient Dog? Instead, we can look at obedience as an aspect that we apply to any type of Dog that is obedient, as opposed to inappropriately forcing that behavior in the Dog hierarchy.

In software terms, aspect-oriented programming allows us the ability to apply aspects that alter behavior to classes or objects independent of any inheritance hierarchy. We can then apply these aspects either during runtime or compile time.

Aspect Oriented Programming and Java

AOP is a concept, so it is not bound to a specific programming language. In fact, it can help with the shortcomings of all languages (not only OO languages) that use single, hierarchical decomposition. AOP has been implemented in different languages (for example, C++, Smalltalk, C#, C, and Java).
Of course, the language that gains a great interest of the research community is the Java language. The following is a list of tools that support AOP with Java:

  • AspectJ
  • AspectWerkz
  • Hyper/J
  • JAC
  • JMangler
  • MixJuice
  • PROSE
  • ArchJava

AspectJ, created at Xerox PARC, was proposed as an extension of the Java language for AOP. The rest of this article is related to AspectJ terminology.


The term “Spring AOP” is now being very popular by time. It is implemented in pure Java. There is no need for a special compilation process. Spring AOP does not need to control the class loader hierarchy, and is thus suitable for use in a J2EE web container or application server.

Spring AOP currently supports only method execution join points (advising the execution of methods on Spring beans). Field interception is not implemented, although support for field interception could be added without breaking the core Spring AOP APIs. If you need to advise field access and update join points, consider a language such as AspectJ.

Aspect Oriented Programming and .NET:

AOP is accomplished in .NET by having Aspect code insert itself and participate in the message-invocation mechanism that takes place between a client and an object. The private Context set up by the .NET runtime for an instance of a ContextBoundObject provides the means for externally defined Aspects to hook into the call chain, because the creation of the private Context forces the creation of .NET proxies. These proxies provide the means for Aspects to hook into the call-chain using message sinks. The reason that ContextBoundObject is required is for clients and objects that are in the same AppDomain that would otherwise have no proxies set up between them. Aspects are thus implemented as event sinks that get called on the message sink chain without any further participation or knowledge on the client’s part. Some important parts of it are:
  • Instances of ContextBoundObject are always associated with a Context.
  • A Context can have zero or more properties which are instances of IContextProperty.
  • The properties are created and added to the Context by custom attributes that annotate the ContextBoundObject. These custom attributes must be instances of IContextAttribute.
  • A context-property can also perform the role of a message sink factory by implementing one or more of the four interfaces, namely, IContributeEnvoySink, IContributeClientContextSink, IContributeServerContextSink, and IContributeObjectSink. A message sink is an instance of IMessageSink
  • Access to a ContextBoundObject is always intercepted by the CLR using proxies and message sinks. A message sink is inserted into the invocation chain by the CLR during object activation and can inject the desired aspect at runtime.
The complexity in some existing code is traced to a fundamental difference in the kinds of properties that are being implemented. Components are properties of a system, for which the implementation can be cleanly encapsulated in a generalized procedure. Aspects are properties for which the implementation cannot be cleanly encapsulated in a generalized procedure. Aspects and cross-cut components cross-cut each other in a system’s implementation. We have been able to develop aspect-oriented programming technology that supports clean abstraction and composition of both components and aspects. The key difference between AOP and other approaches is that AOP provides component and aspect languages with different abstraction and composition mechanisms. A special language processor called an aspect weaver is used to coordinate the co-composition of the aspects and components.

The AOP conceptual framework will be helpful to design the systems, and the AOP-based implementations have proven to be easier to develop and maintain, while being comparably efficient to much more complex code written using traditional techniques.

Saturday, November 13, 2010




To begin with, Ruby is a scripting language, in the recent tradition of Perl, Python, and Tcl. It allows for a rapid development cycle and the rapid prototyping of applications. It is usually interpreted, requiring no compilation step.

Ruby is an open source, interpretedobject-oriented programming language created by Yukihiro Matsumoto, who chose the gemstone's name to suggest "a jewel of a language." Ruby is designed to be simple, complete, extensible, and portable. Developed mostly on Linux, Ruby works across most platforms, such as most UNIX -based platforms, DOSWindowsMacintoshBeOS, and OS/2, for example. According to proponents, Ruby's simple syntax (partially inspired by Ada and Eiffel), makes it readable by anyone who is familiar with any modern programming language.

Ruby supports multiple programming paradigms, including functional, object oriented, imperative and reflective. It also has a dynamic type system and automatic memory management; it is therefore similar in varying respects to Python, Perl, Lisp, Dylan, Pike, and CLU.

The Ruby language has additional features which indicate that in some areas it is more advanced than Java or C. Its strength lies in something known as 'Meta-Programming'. This is the ability to write computer programs that write or manipulate other programs. These abilities mean that Ruby could have important applications in the field of artificial intelligence. Reflection, or the ability of a program to reason about itself, is important for artificial intelligence research and Ruby does this very well.

Ruby is a very intuitive and clean programming language. This makes learning Ruby a less challenging task than learning some other languages. Ruby is also a great general purpose language. It can be used to write scripts in the same way you might use Perl and it can be used to create full scale, standalone GUI based applications. Ruby's usefulness doesn't end there however. Ruby is also great for serving web pages, generating dynamic web page content and excels at database access tasks.

As a newer solution that is designed to help increase the speed with which web sites can be created, Ruby on Rails has both its supporters and detractors. Here is some background on how Ruby on Rails works, and what people have to say about the application.

The principle difference between Ruby on Rails and other frameworks for development lies in the speed and ease of use that developers working within the environment enjoy. Changes made to applications are immediately applied, avoiding the time consuming steps normally associated with the web development cycle. According to David Geary, a Java expert, the Ruby-based framework is five to 10 times faster than comparable Java-based frameworks. In a blog posting, Geary predicted that Rails would be widely adopted in the near future.

Known popularly as ROR or Rails for short, Ruby on Rails is a web application framework option that seeks to use logical steps to help create workable code for the creation of web sites. As an open source project that is written in Ruby program language, Ruby on Rails uses the Model-View-controller design pattern as the foundation for how the framework functions. Ruby programming language has the advantage of being relatively easy for anyone to learn and also follows a logic sequence that many people find easy to follow.

It has been just over a year since the public debut of Ruby on Rails on July 25, 2004. In this short time, Rails has progressed from an already impressive version 0.5 to an awe-inspiring, soon-to-be-released version 1.0 that managed to retain its ease of use and high productivity while adding a mind-boggling array of new features. This article introduces the components of the upcoming Ruby on Rails 1.0 and shows you what the fuss is all about.

There are two basic principles that govern the way that Ruby on Rails works. The first is often referred to as DRY, or Don’t Repeat Yourself. The idea is to keep the language as simplistic as possible, so the code remains simple as well.

The second principle is COC or Convention over Configuration. What this means is that the programmer can rely on defaults on the naming of the classes and tables.

Rails is made up of several components, beyond Ruby itself, including:
  • Active record, an object-relational mapping layer
  • Action pack, a manager of controller and view functions
  • Action mailer, a handler of email
  • Action web services
  • Prototype, an implementer of drag and drop and Ajax functionality
Since its public release in 1995, Ruby has drawn devoted coders worldwide. In 2006, Ruby achieved mass acceptance. With active user groups formed in the world’s major cities and Ruby-related conferences filled to capacity.


Supporters of Ruby on Rails hail the solution as a great way to maximize time spent on developing web pages, as it makes the mechanics of the process simpler. Ruby on Rails is also viewed as allowing more energy to be directed at the creative end of the process, providing more time to look for creative ways to have the web site stand out among so many.

At the same time, detractors of Ruby on Rails say that the solutions stifle the creativity of the programmer, as it creates a cookie-cutter predilection in the process. Dismissed as nothing more than a rigid software option that does not really save much in the way of time, opponents sometimes refer to Ruby on Rails as opinionated software.

Wednesday, October 20, 2010

Give Dynamism to your Website with Silverlight Technology...




In October of 2008, Microsoft released Silverlight, a free runtime programmable web browser plug-in that powers rich application experiences and delivers high quality, interactive video across multiple platforms and browsers, using the .NET framework. Some of the features it enables include animation, vector graphics, and audio-video playback that characterize rich Internet applications.

Developed under the codename Windows Presentation Foundation/Everywhere (WPF/E), Silverlight allows the integration of audio, video and interactivity in a single runtime environment, in the same way the Windows Presentation Foundation does. Working in conjunction with XAML, they contents of a Silverlight application can be indexed and is searchable by search engines.

Content-wise, it supports the usual array of WMV, WMA and MP3 formats without requiring Windows Media Player, Active X control or even a Windows Media Player plug-in. This makes it a one-stop centre for Internet multimedia and eliminates the need to download different plug-ins for the same application.

Silverlight is compatible with Windows Vista Home and Professional Edition as well as with the Windows Mobile 6. Mac users can also download this plug-in since it can be used on the Mac OS.

Essentially, Silverlight 1.0, which was created over a year ago, was intended to be Microsoft's answer to Adobe Flash and Flex and several other rich Internet application and AJAX frameworks. 

Silverlight 1.1 was such an important upgrade for Microsoft that it was eventually renumbered Silverlight 2. Silverlight 2 supported all .Net languages, including the dynamic languages such as IronPython and IronRuby, and it contained a good portion of the .Net base classes, including new features such as LINQ (language-integrated query). In addition to its rich set of controls, it had APIs for an alphabet soup of networking, including REST, SOAP, RSS, and HTTP. 

Silverlight 3.0 will certainly prove to be just as successful. Aside from being the most comprehensive offering for the rapid creation and delivery of sophisticated applications through a Web browser, it is also forged from technology used in over 100,000 companies and understood by over four million developers worldwide. Silverlight has the full support of Microsoft's tools, technologies, and a thriving partner ecosystem.

Silverlight enables you to create a state-of-the-art application that has the following features:

·         It is a cross-browser, cross-platform technology. It runs in all popular Web browsers, including Microsoft Internet Explorer, Mozilla Firefox, and Apple Safari, Google Chrome, and on Microsoft Windows and Apple Mac OS X.
·         It is supported by a small download that installs in seconds.
·         It streams video and audio. It scales video quality to everything from mobile devices to desktop browsers to 720p HDTV video modes.
·         It includes compelling graphics that users can manipulate—drag, turn, and zoom—directly in the browser.
·         It reads data and updates the display, but it doesn't interrupt the user by refreshing the whole page.
·         The application can run in the Web browser or you can configure it so users can run it on their computer (out-of-browser).

The specs might make sense to a web developer, but what about the average man? Normal Internet users won't care whether the site they're visiting is made from Flash or Silverlight. How will it affect them?

Well, Silverlight applications are delivered to a browser in a text-based markup language called XAML. That's no big deal for Web users once they land on a site. But search engines, like Google, can scan XAML. They can't dive into compiled Flash applications. Flash-heavy sites do often wrap their applications in Web code that search engines can crawl, although it's extra work for developers and designers to do it, and may not yield search results that are as good as they would be if the search engine was indexing the actual application instead of keywords tacked on after the fact. Silverlight applications will be more findable.

To run a Silverlight application, users require a small plug-in in their browser. The plug-in is free. If users do not already have the plug-in, they are automatically prompted to install it. The download and installation take seconds and require no interaction from the user except permission to install.

Also, for the users who opt for less-used platforms and browsers such as Firefox and Google Chrome, this plug-in will endear to them, since most Internet applications run on popular platforms. And although Microsoft doesn't usually tread the waters of Mac and other operating systems, most web developers have given positive early reviews to Silverlight and this opens a lot of possibilities.

Silverlight technology is already available for download on select platforms. And although it is still new, it is promising to be an important part of Internet applications in the future.


Tuesday, October 19, 2010

Share your ideas with Microsoft Sharepoint...

SharePoint is a Microsoft platform that allows people to build websites. SharePoint 2010 is the fourth version of SharePoint from Microsoft, and it is also known as SharePoint v4 or Microsoft Office SharePoint Server 2010. It is very different from the versions that came before it.

SharePoint allows people to create websites with different content and different purposes. Its many built-in features and components make it a comprehensive solution that can fit many needs.

Microsoft SharePoint Server is composed of three major tiers:

  •   Web Front End role which processes HTTP requests to the Server;
  •   An application layer which provides such features as Search and Excel Services;
  •   A dedicated Microsoft SQL Server data storage.


Microsoft says it does not intend SharePoint to replace a full file server or to function as a single-use solution. Instead, it positions the product to play various roles in a business environment. While SharePoint users can access SharePoint functionality through multiple methods, the primary user interface is a web-based application accessed through a browser. The majority of SharePoint's functionality is supported across all major desktop web browsers - however, some minor features are restricted to the 32-bit version of Internet Explorer 8. Notably, Internet Explorer 6 is not supported.

A SharePoint site is a Web site accessed through your web browser that provides a collaboration space for documents, information, and ideas, controlled by the Site Owner. It can be used to help groups of people, be they faculty, school or service team to share information and work together. For example, a SharePoint site can help you:

  • Coordinate projects using calendars and schedules.
  • Manage and discuss ideas and review documents or proposals using document libraries.
  • Share information and keep in touch with other people using Wikis and blogs.

One common use of SharePoint in organizations is to create sites that are used for team collaboration. These collaborative sites, also known as team sites or group work sites enable team members to better work with one another. They can use the site to share documents, assign tasks, track team events on a shared web calendar, and much more. This use is known as a team collaboration system.

Many companies use SharePoint for their central document storage, replacing network folders. This use is known as an electronic document management system.

Another common use is as a corporate portal where the corporate employees can go and download forms, read corporate news, fill in surveys, and search for documents. This use is known as an electronic content management system or an intranet.

The capabilities of SharePoint 2010 work together to help your company quickly respond to changing business needs. Using SharePoint 2010, your people can share ideas and expertise, create custom solutions for specific needs, and find the right business information to make better decisions. For IT, SharePoint 2010 helps you cut training and maintenance costs, save time and effort, and focus on higher business priorities. 

Finally, some companies choose the SharePoint platform as the platform for their Internet sites—where visitors from around the world can visit the company's website and read about the company's products, register for events, and do whatever it is the site has been configured to allow them to do. SharePoint sites are dynamic and interactive - members of the site, which you control, can contribute their own ideas and content as well as comment on or contribute to other people's.