A new aspect to programming?There's a small but determined group in the coding community who are only half joking when they declare that real coders write their own device drivers because doing anything else is lazy, technologically unsound unsound said of an animal, usually a horse, which has been examined for soundness and found to be unsatisfactory. , and unnecessarily risky. At the other end of the software spectrum are advocates of new techniques like Aspect Oriented Programming (AOP (Automatic OPerator) An IRC channel host who moderates the topics, keeps online users in check and provides help for newbies unfamiliar with IRC software (mIRC, etc.). Whenever AOPs come into the channel, they inherit operator status. ), who are 100 percent serious when they say that real coders want to be as productive as possible so they can keep their jobs, be more productive and re-use code efficiently rather than re-invent the wheel every day of their working lives. Where did AOP come from? For many years, object orientation (OO) was the vanguard of this movement, but even OO's idea of creating discrete pieces of code for different functions did not mean that coders were freed from re-writing some parts of an application over and over again. Researchers at the famed Xerox Palo Alto Palo Alto, city, California Palo Alto (păl`ō ăl`tō), city (1990 pop. 55,900), Santa Clara co., W Calif.; inc. 1894. Although primarily residential, Palo Alto has aerospace, electronics, and advanced research industries. Research Lab (PARC (Palo Alto Research Center Incorporated, Palo Alto, CA, www.parc.com) Founded in 1970, PARC is a Xerox subsidiary involved in high-tech research and development. Although Xerox's headquarters are in Stamford, Connecticut, and manufacturing and marketing are in Rochester, New York, PARC is ) were examining the limitations of OO in the early 1990s and explored the idea of new ways programming languages might help programmer productivity by easing modularisation of code. At around the same time, then PhD student Cristina Lopes and others at Northeastern University Northeastern University, at Boston, Mass.; coeducational; founded 1898 as a program within the Boston YMCA, inc. 1916, university status 1922, fully independent of the YMCA 1948. in the USA were pursuing similar thinking. Eventually, the USA's Defense Advanced Research Projects Agency Defense Advanced Research Projects Agency (DARPA), U.S. government agency administered by the Department of Defense (see Defense, United States Department of). (DARPA DARPA: see Defense Advanced Research Projects Agency. (Defense Advanced Research Projects Agency) The name given to the U.S. Advanced Research Projects Agency during the 1980s. It was later renamed back to ARPA. ) noticed the work, injected funding and encouraged collaboration between PARC and Northeastern, who combined to create Aspect J, a set of extensions to Java that programmers can now use to apply AOP. AOP's core idea is "separating the business logic in an application from the common services that support it," according to according to prep. 1. As stated or indicated by; on the authority of: according to historians. 2. In keeping with: according to instructions. 3. Adam Magee, a Senior Solution Architect with Avanade, a technology integrator that specialises in Microsoft technologies. AOP practitioners call those common services "crosscutting cross·cut·ting n. A technique used especially in filmmaking in which shots of two or more separate, usually concurrent scenes are interwoven. Also called intercutting. concerns," as the functionality they offer cuts across the needs of many objects in an application. "Cross-cutting concerns could be instrumentation, auditing, logging, security checks or exception handling," says Magee, who has applied AOP to many projects. "Writing code to interface with these services can be very time consuming and it can take a developer a long time to do it. It also distracts them from solving the business problem-which is where the value is-and diverts them to delving around inside complex operating system operating system (OS) Software that controls the operation of a computer, directs the input and output of data, keeps track of files, and controls the processing of computer programs. plumbing Benefits AOP aims to get around these problems by separating the job of writing cross-cutting concerns-also known as "aspects', from the job of writing objects that comprise business logic, then offering structures so that an application can simply use the functions of aspects without needing to rebuild or recode Verb 1. recode - put into a different code; rearrange mentally; "People recode and restructure information in order to remember it" rearrange - put into a new order or arrangement; "Please rearrange these files"; "rearrange the furniture in my room" anything at all. The technique aims to save time by allowing developers to create a definition of the cross-cutting concerns an application requires to suit every object that requires it. So instead of, for example, writing a logging system for each object-a practice AOP characterises as "scattering"--AOP practitioners would suggest that during the design phase of a project, developers should define the logging requirements for every object with the application and then create a single logging tool that performs all the logging functions that will ever be required by any part of the application. AOP's proponents say the benefits of this approach are several. Firstly, the effort that goes into defining all of an application's requirements for a service like logging means the services are better-defined, better-coded and emerge offering richer functionality. It also addresses problems created when code is written to perform more than one function, as changes to one function can impact the other, a problem AOP dubs "tangling. Secondly, making the effort to create discrete aspects allows a development team to assign an expert to the job, so that the best people for the job can exercise their skill and experience. A third benefit is consistency. In a typical object-oriented project different coders will often start with the same code to create a service like logging, then each diverge in their individual implementations of the logging services required to support an individual object. By creating a single piece of code, AOP offers a simple route to consistency, which enhances future re-usability and eases maintenance: Instead of re-writing logging routines throughout an application AOP makes it possible to re-write just the logging aspect and have the new functionality serve the entire application. All of these benefits reduce the number of lines of code The statements and instructions that a programmer writes when creating a program. One line of this "source code" may generate one machine instruction or several depending on the programming language. A line of code in assembly language is typically turned into one machine instruction. that need to be written, saving time, controlling costs and freeing resources for more valuable activities than writing a logging program. AOP at work "Traditionally when you design an application you start by defining the business functions: all the things you need the Technical Analysis COM (1) (Computer Output Microfilm) Creating microfilm or microfiche from the computer. A COM machine receives print-image output from the computer either online or via tape or disk and creates a film image of each page. programmers build their software using COM-aware components. Different component types are identified by class IDs (CLSIDs), which are Globally Unique Identifiers, or GUIDS GUIDS Goals centered design; User interface design; Implementation design interface; Data design; Strategies for construction (object oriented programming methodology) . Each COM component exposes its functionality through one or more interfaces. The different interfaces supported by a component are distinguished from each other using interface IDs (IIDs), which are also GUIDS. COM interfaces have bindings in several languages, such as C, C++, D, Visual Basic, and several of the scripting languages implemented on the Windows platform. All access to components is done through the methods of the interfaces. This allows techniques such as inter-process, or even inter-computer programming (the latter using the support of DCOM (Distributed Component Object Model) Formerly Network OLE, it is Microsoft's technology for distributed objects. DCOM is based on COM, Microsoft's component software architecture, which defines the object interfaces. ). All COM components must (at the very least) implement the standard IUnknown interface. Indeed, all COM interfaces are derived from the IUnknown interface. The IUnknown interface consists of three methods: AddRef () and Release (), which implement reference counting (programming) reference counting - A garbage collection technique where each memory cell contains a count of the number of other cells which point to it. If this count reaches zero the cell is freed and its pointers to other cells are followed to decrement their counts, and so on and control the lifetime of interfaces; and QueryInterface, which by specifying an IID IID Imperial Irrigation District (California) IID Interface Identifier (Component Object Model) IID Ignition Interlock Device (automotive security system) allows a carer carer Noun a person who looks after someone who is ill or old, often a relative: the group offers support for the carers of those with dementia carer n → to retrieve references to the different interfaces the component implements. The effect of QueryInterface () is similar to dynamic-cast<> in C++ or casts in D, Java and C#. COM specifies many other standard interfaces used to allowed inter-component communication. For example, one such interface is IStream, which is exposed by components that have data stream semantics (e.g. a FileStream component used to read or write files). It has the expected Read and Write methods to perform stream reads and writes. Another standard interface is IOleObject, which is exposed by components that expect to be linked or embedded into a container. IOleObject contains methods that allow callers to determine the size of the component s bounding rectangle, whether the component supports operations like 'Open', 'Save' and so on. A running instance of a component can be obtained by asking the COM runtime library A collection of executable software functions in the machine language of the target computer. A runtime library can be linked into an application at compile time with links already resolved from the programmer's code to the functions when the application is loaded. for a class factory and specifying the CLSID (CLasS ID) The identification of a COM object. Applications that support Microsoft's COM architecture register their objects as CLSIDs. See COM and GUID. of the required component. The returned class factory is then asked to create an instance of the desired component, specifying an UD to obtain a particular interface that the component implements. A client then calls interface methods, and finally releases the interface by calling the Release () method. Components can describe themselves using COM Type Libraries. A type library contains information such as the CLSID of a component, the IIDs of the interfaces the component implements, and descriptions of each of the methods of those interfaces. Type libraries are typically used by RAD environments such as Visual Basic or Visual Studio to assist in the programming of COM components. COM programmers are responsible for entering and leaving the COM environment, instantiating and reference counting COM objects, querying objects for version information, coding to take advantage of advanced object versions, and coding graceful degradation of function when newer versions aren't available. COM classes are identified by a Globally Unique Identifier or GUID--a 128-bit number--guaranteed unique worldwide. COM classes must be listed by number in The Registry. COM objects may be referenced from within a process, across process boundaries within a computer, and across a network. A COM object watches its reference count and causes itself to disappear once the reference count goes to zero. Vast amounts of software have been written using COM. There is much visible plumbing involved with COM, especially for C++ programmers. The Microsoft.NET framework puts the plumbing in the walls. www.wickipedia.com |
|
||||||||||||||||

Printer friendly
Cite/link
Email
Feedback
Reader Opinion