Month: October 2009

Aspect Oriented Programming (Part-1)

Posted on Updated on

Hello 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 aspectparadigm (though it’s too old), its basics, its core concept, comparison with current programming paradigms like Object Oriented Programming (OOA) and finally implementation for any real world problem or scenario.

Again, may be my writing style, sentences structure, grammar, spells are not up to the mark, but it isn’t an issue, i will try to focus on contents and concept so kindly accept my apology in advance.

I will post 3, 4 articles for this topic, dividing this in following possible sections

  • Object oriented programming approach and some flaws
  • Core theme of Aspect Oriented Programming
  • Solutions provided by AOP against OOP flaws
  • Important terms use in AOP talk
  • A programming example with OOP and AOP
  • Introduction of aspectJ, a java implementation of aspect oriented approach.

Object Oriented Programming Approach

Computer software or programs are an automation of real world scenarios, a transformation of manual work into computer operated systems. Many approaches are in practice to design and develop more usable, user friendly, easily evolevable and maintainable computer systems. Different approaches handles under-considerate domain with its own style. Object oriented approach focuses on data, takes anything in real world as data having some attributes (data fields) and some operations (methods). This approach evolves in sixth decade of last century when the computer system becomes much more complex and the current programming paradigms were not much capable to cope with required features to facilitate both developer and end users. At that moment researches were make on some new style of programming and then introduced “data focused” approach .i.e. object oriented programming where everything in real life was considered as object, in other words every noun is an object. We design systems based on these nouns in real world like Pay, Account, Employee, Product, PurchaseOrder, Invoice etc

Object oriented approach was at its peak in mid 80’s and late 90’s, even still a great number of computer systems are being developed using object oriented approach, but from its birth, it is facing many critics. Though the implementer of this approach are introducing many new features day by day in their respective languages compilers but only adding feature after feature into something don’t makes it better. Polymorphism, encapsulation, abstraction no doubt are building block of any mature programming language and should available implicitly, yet still there are few areas where developer need more ease and re-usability of their efforts and code. Those area were perceived and make researches and then new approach was presented to design and develop software module with more ease in re-usability of existing code, more ease in extendability and maintainability. This approach was AOP.

Did you ever feel that while development in object oriented world, you have you rewrite same chunk of code in different classes/methods to achieve a same goal? like (as a very simple example) in data access layer, you have to open database connection, maintain its session, writing query, call to database to fetch data and at the end, closing and the database connections and sessions. Like following

method Fetch_Employee_DATA{

open data base session;
create query to fetch data;
call to database to fetch data;
close database session;
return results;

}

here the bold text are those lines of code you have to write in each method you call to fetch data from database, other lines are method specific and depends upon the business logic.

As an other example, if you have to log each and every database call .i.e. the query to database, its parameter, the returned results etc, then you have to write same line of codes every time in each method that is going to interact with database. The above method will look like

method Fetch_Employee_DATA{

log start of method;
open data base session;
create query to fetch data;
log query and its parameters;
call to database to fetch data;
close database session;
log returned data from database;
log end of method;
return results;

}

Again the bold lines are those lines of code you are replicating in each method to achieve a same gaol. Don’t you think you’re spending a lot of time writing the same bits of code when it comes to implementing the individual methods. These things like logging, security checking, transaction management are such aspects of the systems that are orthogonal to the specific application. Every organization need them and every developer has to implement them in their respected module, classes and methods. In short the method hasn’t concern with these replicated lines, or the core concern of the method is to fetch employee, not to log database transactions, session maintenance etc. Every class or method is doing something extra time and again that doesn’t concern to their core requirement.

To small projects for small level organizations, it may work. But what if you are going to design and develop a banking system, an ERP for large scale company, or a payroll system for big industry … where the modules are interlink cohesively, the domain is very large, covering all business scenario of under-considerate organization. In such system, you can’t afford such framework and design that is difficult to extend, maintain and reuse. You can’t let your developers to spend time and resources over rewriting the same bit of code in every class and method, instead of focusing core business logic of that class. In other words, you can’t let everyone to focus on those things that are not concerned with their core task.

Consider the above example again. You are working in on a project (let suppose inventory management). While developing different features or modules, you have to call database to fetch and insert data as per business logic and domain requirement. We have seen that in every method you write, you are writing code of opening database session, and for closing it properly. In a medium and large scale project, the number of methods doing the same things could be hundreds. Any how, you complete your task and deploy the application at client site. Next time you are ask to maintain logs for each database interaction (as we discussed above) you instantly recall the number of classes and methods where you have to write code related to logging …. you have more then 40, 50 classes (let suppose) and there are hundreds of methods interacting with database. You have to open each method’s body and has to write logging code there ….

“Sir it will take atleast 4,5 days to complete this task”

“4, 5 days, but way, its really a simple task”

“indeed its simple but i have review each and every package, class and method to embed logging code there. To make sure the sustainability of application, i have to test it thoroughly to check that our existing application are new changes are running fine”

“hmmm ok, add someone else with you and try to complete it within 2,3 day, there are lot of other things too to do”

“sure i will”

This is the expected dialog between a developer and his manager/team lead while incorporation a simple change in running application. See, the actual lines that has to write in every method are very simple, just 2, 3 lines. But when it span over entire application with hundreds of packages/classes/methods then it becomes worst, consuming your more resources in term of human effort, time and budge.

Think again … is the logging concerned to method which was written to fetch data from database? Should a developer concern with database issues like opening a session and closing it properly who want to focus his attention to design an optimal query to fetch data from database?

In next post i will introduce Aspect Oriented Programming (AOP) and will discuss how AOP provides solutions for problems we discussed earlier.

Share on Facebook

Advertisements

This is World …

Posted on Updated on

col

Microsoft Simplifies the PC With Windows 7

Posted on Updated on

NEW YORK — Oct. 22, 2009 — Today Microsoft Corp. announced the worldwide availability of its new Windows 7 operating system. Windows 7 delivers on a simple premise: make it easier for people to do the things they want on a PC. The new operating system offers a streamlined user interface and significant new features that make everyday tasks easier and allow people to get the most out of computers of all styles and sizes.windows-7-aurora-green-wallpaper

“With Windows 7, there’s never been a better time to be a PC,” said Microsoft CEO Steve Ballmer. “Together with our partners, we’re bringing more choice, flexibility and value to the market than ever before. With Windows 7, you’re sure to find a PC that fits your life.”

Building Windows 7 has been a collaborative process from the beginning, with Microsoft’s engineers and designers working with customers and partners to build an operating system that delivers on the vision of the PC, simplified. In a speech in New York, Ballmer thanked the millions of volunteers who helped improve the product by testing early versions.

“A project with the global customer reach of Windows can only be done as a team,” said Steven Sinofsky, president of the Windows and Windows Live Division at Microsoft, speaking at a launch event in Tokyo. “We are grateful for the valuable contributions from customers, partners and developers around the world that helped make Windows 7 such a collaborative project.”

windows-7-install

On Sale Worldwide Today

The global availability of Windows 7 is joined by an unprecedented array of new PCs and software programs. With more PC options available for customers today at a wide range of price points starting under $300, customers can choose the PC that fits their personality, style and needs, from netbooks, ultrathin notebooks and highly interactive multitouch laptops to all-in-one desktops and high-end, water-cooled gaming machines.

A newly launched section of Windows.com called PC Scout will guide users through selecting and purchasing the right PC. Customers can purchase PCs with Windows 7 or software upgrades online or in-store from technology retailers or at the new Microsoft Store, launching today in its first retail location in Scottsdale, Ariz., and expanded online. Retailers and technology partners are also featuring a series of limited-time offers for customers looking for great deals on Windows 7-based PCs, devices and software. Information on these offers can be found at http://www.windows.com.

To show how Windows 7 simplifies the PC, today Microsoft is launching the next wave of its global “I’m a PC” campaign. The global enthusiasm of Windows users is also contributing to the way many people around the world will experience Windows 7 for the first time. Tens of thousands of customers have volunteered to host launch parties or meet-ups beginning today, showing off Windows 7 to friends and family members.

windows_7_ms1-400x300

Simplifying the PC

Over the past 18 months, feedback from more than a billion opt-in customer sessions and 8 million beta testers validated Microsoft’s research on how to simplify everyday tasks. Here are a few of the many ways users will experience a more simplified PC with Windows 7:

Simplifies Everyday Tasks

Taskbar. The go-to spot for launching programs and switching windows, the taskbar has been completely redesigned to help users work smarter, cut clutter, and get more done, with features such as thumbnail previews of Web pages, documents — even running video.

HomeGroup. Users can easily share their files and printers with other PCs running Windows 7 in their home.

Windows 7 Device Stage. This shows the status of all connected devices such as cameras and mobile phones, and makes it easier to synchronize and manage them.

Photos and videos. Windows Live Photo Gallery and Windows Live Movie Maker (available via download) offer customers great, free options to edit photos and videos and easily share them with loved ones.

Snap. Users can drag an open window to the screen’s border to automatically re-size it. Snap two different windows to the left and right borders for a perfect comparison.

Shake. Users can click on a window pane and shake the mouse to minimize all other open windows, then shake the pane again to restore the windows to their original sizes.

Internet Explorer 8. Microsoft’s fastest, easiest and safest browser ever offers smart new features such as Instant Search, Accelerators and Web Slices to help users get more out of the Web.

Works the Way Users Want

Faster on, faster off. Every Windows 7 user will benefit from the focus on underlying performance, faster startup, resuming and shut down time, and enhanced power management.

Mobile made easier. All of a user’s mobile computing settings are in one place with the Windows Mobility Center.

Protecting the PC. Safeguarding the data on a PC is easier with advanced backup capabilities and the free Microsoft Security Essentials download to help protect users against viruses, spyware and other malicious software.

windows-7-desktop

Makes New Things Possible

Windows Touch. Users can interact with the PC with a touch-screen monitor, using their fingers and multitouch gestures.

PlayTo. Users can stream their digital music, videos and photos to other PCs or devices such as an Xbox 360 console connected to the TV.

Internet TV. New content providers and an improved interface make it even easier to watch TV on the PC.

Rich gaming and graphics. Windows 7 includes performance enhancements that take power gaming and entertainment to a new level, with 64-bit support and DirectX 11 graphics.

Location-aware printing. Documents are sent to the right printer whether it’s at home or at the office. And with Offline Files users can work offline and automatically synchronize between a PC and documents on their office network.

Partners Rally Around Windows 7

windows7-20081028-1

Along with increased customer involvement, Microsoft’s partners had a closer, more involved role in the product vision and planning process with Windows 7. The collaborative approach to engaging partners to inform development efforts has resulted in improved performance for PCs as well as compatibility with a broad range of software and hardware across the Windows ecosystem. More than 50,000 developers from 17,000 companies are enrolled in the Windows Ecosystem Readiness Program to build solutions for Windows 7. Together, these partners are developing hardware, software and services capable of reaching more than a billion PCs around the world.

SIM Information System – 668

Posted on Updated on

Pakistan Telecommunication Authority (PTA) has developed a SIM (Subscriber Identity Module) information system to address associated risks on security and to ensure subscription regulations in cellular sector.sim

The objective of the project is to provide a consumer-based facility to mobile subscribers in Pakistan by which they would be able to find out the total number of SIM(s) registered against their respective CNIC number with each mobile operator.

Kindly visit http://www.pta.gov.pk/668/index.html for more information.

LİNUX BEAUTY (UBUNTU)

Posted on Updated on

its simply great.

ubuntu

RIM Launches BlackBerry Desktop Manager for Mac Users

Posted on Updated on

Finally RIM launches BlackBerry desktop manager for Mac users. This new software makes it easy to sync data between Mac applications and BlackBerry smartphones.

Waterloo, ON – Research In Motion (RIM) (NASDAQ: RIMM, TSX: RIM) has exciting news for Mac® users that want an easy and reliable solution that syncs their contacts, calendar appointments, tasks and notes with their BlackBerry® smartphones. A new version of the BlackBerry® Desktop Manager software has been developed specifically for Mac users. The new desktop software is scheduled to be available for free download from http://www.blackberry.com/mac.

The new BlackBerry Desktop Manager software allows Mac users to smoothly and seamlessly sync data from Mac applications like iCal®, Address Book, Microsoft® Entourage® and others, as well as add and remove applications, schedule automatic backups, encrypt backup files and install software updates for their BlackBerry smartphone.

BlackBerry Desktop Manager Software also integrates BlackBerry Media Sync, enabling Mac users to sync their iTunes® music collections with their BlackBerry smartphone*. From within the BlackBerry Desktop Manager software, users simply select the desired iTunes playlists and the music, including song information and album art, is quickly transferred onto their BlackBerry smartphone.

BlackBerry Desktop Manager software is designed to run on Mac computers with Mac OS 10.5.5 and higher and supports BlackBerry smartphones running BlackBerry OS 4.2 and higher.

* Certain music files may not be supported, including files that contain digital rights management technologies

Key features that will be released with the first build include:

  • Sync your iTunes® playlists, calendars, contacts, notes and tasks
  • Add/Remove applications
  • Update your device when new software becomes available
  • Backup and restore your device data with such features like automatically scheduled backups and optional encryption (security is #1 as always…)
  • Manage multiple devices
  • It will support Mac® OS 10.5.5 and above.

Make sure to get notified of the release at BlackBerry.com/Mac.

the one i liked most
(the one i liked most)

Bryan Adams – (Everything I Do) I Do It For You

Posted on Updated on

Look into my eyes

You will see, what you mean to me
Search your heart, search your soul
When you find me, then you’ll search no more

Don’t tell me it’s not worth trying for
You can’t tell me it’s not worth dying for
You know it’s true,

everything I do I do it for you

Look into your heart, you will find
There is nothing there to hide
Take me as I am, take my life
I would give it all, I would sacrifice

Don’t tell me it’s not worth fighting for
I can’t help it, there’s nothing I want more
You know it’s true,

everything I do I do it for you

There is no love,  like your love
And no other, could give me more love
There’s nowhere, unless you’re there
All the time, all the way

You can’t tell me it’s not worth trying for
I can’t help it, there’s nothing I want more
I would fight for you, I’d lie for you
Walk the wire for you, yeah I’d die for you

You know it’s true
Everything I do
I do for you

[really heart touching lyrics … and bryan make them absolutely marvellous]