Component-Based Software Engineering Component process.

Slides:



Advertisements
Similar presentations
Component Oriented Programming 1 Chapter 2 Theory of Components.
Advertisements

The Web Warrior Guide to Web Design Technologies
Chapter 3 Working with Text and Cascading Style Sheets.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 19 Slide 1 Component-based software engineering.
AP 08/01 Component Programming with C# and.NET 1st Class Component Support Robust and Versionable Creating and using attributes API integration –DLL import.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Advanced Object-Oriented Programming Features
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
Page 1 Building Reliable Component-based Systems Chapter 4 - Component Models and Technology Chapter 4 Component Models and Technology.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
C++ fundamentals.
Component-Based Software Engineering CSM-15 Paul Krause.
COMPONENT-BASED SOFTWARE ENGINEERING
Dr. Eman M. Saleh Al-Maghary
Introduction 01_intro.ppt
1 Integrated Development Environment Building Your First Project (A Step-By-Step Approach)
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
4.1 JavaScript Introduction
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Java Beans.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 19 Slide 1 Component-based software engineering 2.
Microsoft Visual Basic 2005: Reloaded Second Edition
Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Component-based software engineering
Web Services Week 2 Aims: Getting started with creating simple C# applications within Visual Studio.NET Objectives: –An introduction to the syntax of C#.NET.
C# Programming Fundamentals of Object-Oriented Programming Fundamentals of Object-Oriented Programming Introducing Microsoft.NET Introducing Microsoft.NET.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Prepared by: Sanaz Helmi Hoda Akbari Zahra Ahmadi Sharif University of Tech. Summer 2006 An Introduction to.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Lecture Set 1 Part C: Understanding Visual Studio and.NET – Applications, Solutions, Projects (no longer used – embedded in Lecture Set 2A)
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Introduction of Geoprocessing Topic 7a 4/10/2007.
Hyper/J and Concern Manipulation Environment. The need for AOSD tools and development environment AOSD requires a variety of tools Life cycle – support.
Component Programming with C# and.NET. C# components The most commonly used components in.NET are the visual controls that you add to Windows Forms such.
Module 3: Working with Components. Overview An Introduction to Key.NET Framework Development Technologies Creating a Simple.NET Framework Component Creating.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Systems Analysis and Design in a Changing World, 3rd Edition
DEV337 Modeling Distributed Enterprise Applications Using UML in Visual Studio.NET David Keogh Program Manager Visual Studio Enterprise Tools.
SWE 316: Software Design and Architecture Objectives Lecture # 18 Introduction to Components SWE 316: Software Design and Architecture To learn:  benefits.
Lection №5 Modern integrated development environment.
C# Programming: From Problem Analysis to Program Design1 10 Advanced Object-Oriented Programming Features C# Programming: From Problem Analysis to Program.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
Attributes C#.Net Software Development Version 1.0.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files 8/10/ :35 PM.
©Ian Sommerville 2006MSc module: Advanced Software Engineering Slide 1 Component-based software engineering.
.NET Mobile Application Development XML Web Services.
Introduction of Geoprocessing Lecture 9 3/24/2008.
Using Workflow With Dataforms Tim Borntreger, Director of Client Services.
Building Custom Controls with ASP.NET and the Microsoft ®.NET Framework Rames Gantanant Microsoft Regional Director, Thailand
Chapter 17 - Component-based software engineering
The 100% Inspiration Tour.
Object-Oriented Analysis and Design
Chapter 17 - Component-based software engineering
Component Based Software Engineering
Introduction to C# AKEEL AHMED.
Component-Based Software Engineering
Analysis models and design models
Using Cascading Style Sheets (CSS)
Introduction to AppInventor
Chapter 17 - Component-based software engineering
Presentation transcript:

Component-Based Software Engineering Component process

Exist Component

The component identification process

Connector Design :Button :Motor :Meter pressed start stop speed value

Connector Design :Button :Motor :Meter pressed start stop speed value :OR :Threshold a b a  b a > b a < b :Multiplier :Selector {1, 10, 100} :Selector {1, 10, 100} ab a x b 5:int a b

Component Engineering For those requirements that are addressed with available components, the following software engineering activities must be done: For those requirements that are addressed with available components, the following software engineering activities must be done: 1. Component qualification 2. Component adaptation. 3. Component composition. 4. Component update.

Component qualification  Component qualification ensures that a candidate component will perform the function required, will perform the function required, will properly fit into the architectural style specified for the system, and will properly fit into the architectural style specified for the system, and will exhibit the quality characteristics (e.g., performance, reliability, usability) required for the application. will exhibit the quality characteristics (e.g., performance, reliability, usability) required for the application.

Component adaptation  In some cases, existing components may be mismatched to the architecture’s design rules. These components must be adapted to meet the needs of the architecture  adaptation technique called “component wrapping” is often used.

Component adaptation--wrapping  When a software team has full access to the internal design and code for a component, white-box wrapping is applied. This wrapping examines the internal processing details and makes code-level modifications to remove any conflicts.  Grey-box wrapping is applied when the component library provides a component extension language or API that enables conflicts to be removed or masked.  Black-box wrapping requires the introduction of pre- and post-processing at the component interface to remove or mask conflicts.

Component composition  The process of assembling components to create a system.  Composition involves integrating components with each other and with the component infrastructure.

Types of composition  Sequential composition where the composed components are executed in sequence. This involves composing the provides interfaces of each component.  Hierarchical composition where one component calls on the services of another. The provides interface of one component is composed with the requires interface of another.  Additive composition where the interfaces of two components are put together to create a new component.

Types of composition

Interface incompatibility  Parameter incompatibility where operations have the same name but are of different types.  Operation incompatibility where the names of operations in the composed interfaces are different.  Operation incompleteness where the provides interface of one component is a subset of the requires interface of another.

Incompatible components

Composition through an adaptor  The component postCodeStripper is the adaptor that facilitates the sequential composition of addressFinder and mapper components.

Adaptor for data collector

Photo library composition

Component update  When systems are implemented with components, update is complicated by the imposition of a third party. The organization that developed the reusable component may be outside the immediate control of the software engineering organization.

New Component

Again, What is a component ?  A component makes its services available through interfaces and interfaces are of certain types or categories

Printing Services Component

Component Abstractions  Functional abstraction The component implements a single function such as a mathematical function The component implements a single function such as a mathematical function  Data abstractions The component represents a class in an object- oriented language The component represents a class in an object- oriented language  Cluster abstractions The component is a group of related classes that work together The component is a group of related classes that work together  System abstraction The component is an entire self-contained system The component is an entire self-contained system

23 New Component  To design and develop the internals of a components we distinguish four levels of abstraction Component specificationComponent specification Component implementationComponent implementation Component executableComponent executable Component deploymentComponent deployment  The process can be carried out using techniques like UML and OO programming languages, and methodologies supporting component production.

Component Specification  Provides Interfaces The services a component can offer to a client The services a component can offer to a client  Requires Interfaces The services required by a component to help it deliver its promises The services required by a component to help it deliver its promises  Context of Use The “world” the component lives in The “world” the component lives in

25 Component implementation  It defines the inside of a component, with its internal parts and collaborations.  It occurs after the decision of the programming language to use for the development  It must satisfies the specification One-to-many relationship One-to-many relationship

26 Component executable  It is the real pluggable component used in the assembly of the application  Each executable may results in more than one version There may be more than one executable per implementation There may be more than one executable per implementation

27 Component deployment  It is the deployment of the component executable on a number of nodes  There may be several deployment for the same executable.

Component Programming with C# and.NET

C# components  The most commonly used components in.NET are the visual controls that you add to Windows Forms such as the Button Control (Windows Forms), ComboBox Control (Windows Forms), and so on. Button Control (Windows Forms)ComboBox Control (Windows Forms)Button Control (Windows Forms)ComboBox Control (Windows Forms)  Non-visual components include the Timer Control, SerialPort, and ServiceController among others. Timer ControlSerialPortServiceControllerTimer ControlSerialPortServiceController

What defines a component?  What defines a component in C#? Properties, methods, events Properties, methods, events Design-time and runtime information Design-time and runtime information Integrated help and documentation Integrated help and documentation

AP 08/01 public class Button: Control { private string caption; private string caption; public string Caption { public string Caption { get { get { return caption; return caption; } set { set { caption = value; caption = value; Repaint(); Repaint(); } }} Properties  Properties are “smart fields” Natural syntax, accessors, inlining Natural syntax, accessors, inlining Button b = new Button(); b.Caption = "OK"; String s = b.Caption;

AP 08/01 Indexers  Indexers are “smart arrays” Can be overloaded Can be overloaded public class ListBox: Control { private string[] items; public string this[int index]{ get { return items[index]; } set { items[index] = value; Repaint(); } ListBox listBox = new ListBox(); listBox[0] = "hello"; Console.WriteLine(listBox[0]);

AP 08/01 Events  Efficient, type-safe and customizable Built on delegates Built on delegates public class MyForm: Form { public MyForm() { Button okButton = new Button(...); okButton.Click += new EventHandler(OkButtonClick); } void OkButtonClick(…) { ShowMessage("You clicked OK"); }

Events  Events enable a class or object to notify other classes or objects when something of interest occurs class  The class that sends (or raises) the event is called the publisher and the classes that receive (or handle) the event are called subscribers.

Example  Arithmetic component which does addition  We will create a component called CSAddComp1 and package it into a dll (Dynamic Linked Library).  This component has two properties and a method.  Properties take input for the addition and method called Sum( ).

Example  To create properties in C# you use the get and set accessors.  The get accessor is used for getting (reading).  The set accessor for setting (writing) the property

Component Program using System; namespace CompCS { public class CSAddComp1 { private int varI=0,varJ=0; public int varI { get { return varI; } //this is property get for varI set { varI=value; } //this is property set for varI } public int varJ { get { return varJ; } // this is property get for varJ set { varJ=value; } // this is property set for varJ } public int Sum() { return varI+varJ; //this returns the sum of two variables } } //end of class } } //end of class } //end of namespace } //end of namespace

DLL package DLL package  To package the component as dll there is slight change in usual compilation process.  Its little complicated process when compared to normal stand-alone program compilation. csc /out:CSAddComp1.dll /target:library CSAddComp1.cs  Here the /out switch to put the compiled component in the relative subdirectory and file for convenience.  Likewise, we need the /target:library switch to actually create a DLL rather than an executable with a.dll file extension.

client program client program using System; using CompCS; class clAddComp1 { public static void Main() { CSAddComp1 addComp= new CSAddComp1(); addComp.varI=10; //property set for varI addComp.varJ=20; //property set for varJ //below property get for varI Console.WriteLine("variable I value : {0}",addComp.varI); //below property get for varJ Console.WriteLine("variable J value : {0}",addComp.varJ); // calling Sum(..) method Console.WriteLine("The Sum : {0}",addComp.Sum()); } //end of Main } // end of Class

Component Designer in C# Component Designer in C#  To display the designer, from the Project menu, select Add Component.  The Add New Item dialog box appears.  By default, the Component Class item is selected.  Click OK to add a new component to project and open the Component Designer. 

As an example, to package the alarm functionality we built the Timer component, let's build anAlarmComponent class. To create a new component class, right-click on the project and choose Add | Add Component, enter the name of your component class, and press OK. You'll be greeted with a blank design surface,

using System; using System.ComponentModel; using System.Collections; using System.Diagnostics; using System.Diagnostics; namespace Components { public class AlarmComponent : System.ComponentModel.Component { private Timer timer1; private System.ComponentModel.IContainer components; private System.ComponentModel.IContainer components; public AlarmComponent(System.ComponentModel.IContainer container) { container.Add(this); InitializeComponent(); InitializeComponent(); } } public AlarmComponent() { InitializeComponent(); } InitializeComponent(); } private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1.Enabled = true; }}}

Attributes  We can use attributes to define both design-level information (such as help file, URL for documentation) and run- time information (such as associating XML field with class field).  We can also create "self-describing" components using attributes.

Attributes [HelpUrl(“ class SomeClass { [WebMethod] void GetCustomers() { … } string Test([SomeAttr] string param1) {…} }  Appear in square brackets  Attached to code elements

Apply attributes  Define a new attribute or use an existing attribute by importing its namespace from the.NET Framework.

Example using System; public class AnyClass { [Obsolete("Don't use Old method, use New method", true)] static void Old( ) { } static void New( ) { } public static void Main( ) { Old( ); } }

Example  we use attribute Obsolete, which marks a program entity that should not be used.  The first parameter is the string that can be any text.  The second parameter tells the compiler to treat the use of the item as an error.  Default value is false, which means compiler generates a warning for this.

Attribute Fundamentals  Attributes are classes! Completely generic class HelpUrl : System.Attribute { public HelpUrl(string url) { … } … } [HelpUrl(“ class SomeClass { … }

Attributes to specify DLL Imports [DllImport("gdi32.dll",CharSet=CharSet.Auto)] public static extern int GetObject( int hObject, int nSize, [In, Out] ref LOGFONT lf); [DllImport("gdi32.dll")] public static extern int CreatePen(int style, int width, int color);

Component & attributes  components can be displayed in a designer, such as Visual Studio.NET, but required attributes that provide metadata to design-time tools.  A DesignerAttribute attribute is applied at the class level and informs the forms designer which designer class to use to display the control.  Components are associated with a default designer (System.ComponentModel.Design.ComponentDesig ner), and Windows Forms and ASP.NET server controls are associated with their own default designers.  Apply DesignerAttribute only if you define a custom designer for your component or control.

To add a security attribute to a code member of your component using System.Security.Permissions; [FileIOPermission(SecurityAction.Demand)] public void FileDeleter() { // Insert code to delete files. }

COM Support .NET Framework provides great COM support TLBIMP imports existing COM classes TLBIMP imports existing COM classes TLBEXP exports.NET types TLBEXP exports.NET types  Most users will have a seamless experience

Building COM components using.NET Framework  Create C# - Class Library project  Develop the AccountManager.cs library  Modify the generated AssemblyInfo.cs to add the right assembly information  Build the Project Files  Deploy the component as a Shared Assembly, and Configure the Assembly in the COM+ Catalog

Configure your Project Property Pages with the right information

add the right assembly information [assembly: AssemblyTitle("AccountManager for Bank")] [assembly: AssemblyDescription("Creates and Deletes Accounts for the Bank")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("eCommWare Corporation")] [assembly: AssemblyProduct("COM+ Bank Server")] [assembly: AssemblyCopyright("(c) 2001, Gopalan Suresh Raj. All Rights Reserved.")] [assembly: AssemblyTrademark("Web Cornucopia")] [assembly: AssemblyCulture("en-US")]

Calling into a COM component  Create.NET assembly from COM component via tlbimp  Client apps may access the newly created assembly using System; using System.Runtime.InteropServices; using CONVERTERLib; class Convert { public static void Main(string [] args) { CFConvert conv = new CFConvert();... fahrenheit = conv.CelsiusToFahrenheit( celsius );