1.42k likes | 1.59k Views
Components and Architecture. The Software Architecture.
E N D
The Software Architecture “The software architecture of a program or computing system is the structure or structures of the system, which comprise software components [and connectors], the externally visible properties of those components [and connectors] and the relationships among them.” Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Architecture Design Process • Can be seen as a function that: • Takes a requirement specification as input. • Generates an architectural design as output. • Is not an automated process, necessitating great effort and creativity from the involved software architects. • Is comprised of three steps: • Functionality-based design. • Assessment of the quality attributes. • Architecture Transformation. Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Requirement specification Functionality-based architectural design Architecture transformation Estimate quality attributes QA-optimizing solutions General software architecture design process Requirement selection (Partial) requirement specification F.R. Application architecture OK Yes not OK OK More Requirements? no Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Functionality-based Design • The design process starts with functionality-based design and consists of four steps: • Defining the boundaries and context of the system. • Identification of archetypes. • Decomposition of the system into its main components. • The first validation of the architecture by describing a number of system instances. Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Assessment of the quality attributes • The second phase is the assessment of the quality attributes in which: • Each quality attribute is given an estimate. • If all estimated quality attributes are as good or better than required, the architectural design process is finished. • If not the third phase of software architecture design is entered: architecture transformation Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Architecture Transformation • Is concerned with selecting design solutions to improve the quality attributes while preserving the domain functionality. • The design is again evaluated and the same process is repeated if necessary. • The transformations (i.e. quality attribute optimizing solutions) generally improve one or some quality attributes while they affect others negatively. Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Architecture-driven Component Development • The goal for the embodiment phase of design is to either build or select components and connectors that possess the quality attributes identified during the architecting phase of development. • Three types of components: • Custom built components • Reusable components • Commercial components Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Custom Components • Demands both time and money. • Are most likely to pay off in cases of software that are: • Very unusual • Safety critical • Highly secure • The component assembly will possess the quality attributes it was designed around. Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Pre-existing Components • There are two main classes of pre-existing components: • Reusable components • Commercial components • Is a fundamentally different problem than custom design. • The requirements to use specific components and component frameworks drive the architecture. Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Reusable Components • Can exist on a wide scale of reusableness within any organization. • They must be adapted; • In most cases it will be necessary to create adaptors, often referred to as glue code. • Are developed with reuse in mind. • Product line development exemplifies the use of pre-planned reusable components. Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Commercial Components • Introduce a large degree of uncertainty. • Tend to be • Complex • Idiosyncratic • Unstable Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Component-driven Architecture Development • Constraints due to the use of pre-existing components: • Design freedom is limited to component selection. • Sufficient information about how a component will behave is not generally provided. • Component properties must be verified. • The framework into which components are to be plugged influences the architecture and the process by which the system is designed. • Such components can not be optimized. Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Component-driven Architecture Development • It is expected that more reliable systems will be produced, with greater speed and at lower expense due to the restrictions on design freedom. Building Reliable Component-based SystemsChapter 3 - Architecting Component-Based Systems
Chapter 4 Component Models and Technology Building Reliable Component-based SystemsChapter 4 - Component Models and Technology
it needs effective communication mechanisms between applications Windows purpose : moving integration between applicative functions to O.S. level • Excel-generated pie chart embedded in a Word document displayed in a PowerPoint presentation • Different applications need to share data or procedures
COM OLE DDE clipboard A little history: starting with evolution of Microsoft approach DCOM ActiveX OCX
DDE (Dynamic Data Exchange) • What if spreadsheet and word processor need to share data? • Microsoft comes out with Dynamic Data Exchange (DDE), circa 1989 • Lets different Windows programs share data through links • Suppose some spreadsheet data were linked into word processor • When you changed data in spreadsheet, the new data would appear in word processor • Limitation: you couldn’t update the data in the word processor; you had to invoke the spreadsheet to update the date there • Worse, links were fragile and would break if you moved data files around in file system
Object Linking and Embedding OLE (circa 1991) • A way for Windows to create documents containing objects from other programs. • Embedding lets users copy a snapshot of data into word processor and save it there • The objects are components (word processor document, spreadsheet, picture) can be linked together and pass messages to each other according to a standard protocol, Object Linking and Embedding (OLE). • Components containers can be re-used by many applications to for E.g. place a chart from Excel and a slide from PowerPoint into a Word document • But OLE is a platform-specific solution.
OLE Technology (circa 1993) • A set of APIs to create and display a (compound) document • Now possible to share code as well as data • Component Object Model (COM) • COM now includes OLE as part of a larger concept • OLE becomes a set of standard COM interfaces • COM protocols let components connect to origination program: • E.g. word processor can tell spreadsheet, “the user just clicked on the spreadsheet, so start yourself up, look for data here, and let me know when you’re done.” • If the user decides to edit the embedded data, Windows activates the originating application and loads the embedded document
For example, a desktop system might include a picture in a bitmap editor using OLE
Component Object Model • The component object model (COM) provides a specification for using components produced by various vendors within a single application running under the Windows operating system. • COM objects can be created with a variety of programming languages. Object-oriented languages, such as C++, provide programming mechanisms that simplify the implementation of COM objects. • not an object-oriented language but a binary standard
Microsoft COM • COM encompasses: • COM interfaces (implemented as COM objects) • COM Object locations are stored in registry • a set of mechanisms for registering and passing messages between COM interfaces. • COM interfaces are defined in Microsoft Interface Description Language (MIDL).
COM components in Registry Windows has many COM components. Registered under “\HKEY_CLASSES_ROOT\CLSID” on the registry.
OLE Extensions (OCX) • With Windows 95 came a new standard: • OCX (OLE Custom eXtension component) • A piece of code, smaller than application program, but with its own user interface • Let users bundle OCX controls to form customized applications (component composition)
OCX Charting and Graphing example code for Visual Basic • When installing the ProEssentials product, the setup program installs the ProEssentials DLL and OCX Charting interfaces into the system directory. • The setup program also registers the OCX Charts with the operating system, which prepares Visual Basic for inclusion of ProEssentials components
OCX Charting and Graphing example code for Visual Basic the [Components] dialog and places those items selected into Visual Basic's ToolBox as shown.
ActiveX (circa 1996) • Active X, like Java Applets, supports Internet xistributed computing. ActiveX components communicate with each other via events. • Writing a program to run in the ActiveX environment creates a self-sufficient program that can run anywhere in ActiveX network • This component is known as an ActiveX control, and is often used to attach a program to a web page
Distribution option spectrum ActiveX Comp Thick client The Thick client option is where the server simply provides data management and application services are implemented on the client by using ActiveX component
Three-tier architecture for an Internet banking system Chapter 18 Distributed software engineering
ActiveX - implementation • An ActiveX control can be created using one of several languages or development tools, including C++ and Visual Basic, or with scripting tools such as VBScript. • ActiveX controls originally were Windows only • Other vendors later provided Mac and Unix/Linux support for ActiveX • Security issues: ActiveX controls have full file access (no sandbox) • Can be signed for authentication
Creating ActiveX Component No Customization Creator End User Customization Creator Developer End User Design Time Run Time • For each component The Component Creator can enable Customization (where developer can insert code in the design time for customization) by defining • Events (handling user interface ) ActiveX component Could be mapped to internal User Contol events by using RaiseEvent . Eg. Button Click, Mouse Down • Properties Using Get and Let • mapped to internal UserContol properties. E.g button Caption • New Property • Methods New methods
Creating ActiveX Component Example Mapping Events (written by creator)
Creating ActiveX Component Example Mapping Propriety Get: just returns the current string found in the Caption property of the command button Let: takes a new string and just assigns it to the Caption property of the command button
Using ActiveX Component At design timedeveloper could write the following code to customize the Bitton Component nn= Bitton1.Caption .. This will call the Get sub in to nn Bitton1.Caption = “ok” …. This will call the Set sub Private Sub Bitton1_Click () Msgbox (“hello world”) End Sub Private Sub Bitton1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y) Msgbox (“I am moving”) End Sub
Tax Components Result Enter Amount Enter Tax % Show Result Clear • For this SC what are the events, properties, methods • For no customization (using it as it is created) • For customization
Tax Components Result Enter Amount Enter Tax % Show Result Clear • (not customizable) Events such as Show Result , Clear event are internal Private Sub Command1_click () TextField3.value = TaxTotal() End Sub Private Sub Command2_click () TextField3.text = “ “ End Sub
Tax Components Result Enter Amount Enter Tax % Show Result Clear • (simple customizable) Mapping property • Properties ResultColor done by creator Property Get ResultColor () ResultColor = TextField.color End Properity Property Let ResultColor (cc) TextField.color = cc End Properity • Using this Property by simply done by designer TaxComponent1. ResultColor = “red”
Tax Components Special Function Result Enter Amount Show Result Clear • (advanced customizable) Events such as button click Private Sub Command3_click () RaiseEvent Click End Sub
Tax Components Special Function Result Enter Amount Show Result Clear (advanced customizable) • Properties Such as caption Property Get caption () caption = button3.caption End Property Property Let caption () button3.caption = tt End Property
Tax Components Special Function Result Enter Amount Show Result Clear (advanced customizable) • At design time a designer wants to add new function AmountAfterTax to button 3 TaxComponent1.Caption = “ Amount After Tax” Private Sub TaxComponent1_Click() AmountAfterTax=Textfield1.value*TaxPer/100) Result = AmountAfterTax End Sub
Tax Components Amount After Tax 233 Result Enter Amount Show Result Clear At Run time