Software Component Technologies: - PowerPoint PPT Presentation

1 / 71
About This Presentation
Title:

Software Component Technologies:

Description:

All of these are replaceable but which of these are ... (t.ThreadState&ThreadState.Unstarted)!=0); Console.WriteLine('Main Thread ending'); return 0; ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 72
Provided by: damienw7
Learn more at: https://www.cse.scu.edu
Category:

less

Transcript and Presenter's Notes

Title: Software Component Technologies:


1
  • Software Component Technologies
  • Introduction

2
What Are Components?
  • A consistent part.
  • - Macquarie Dictionary 1985
  • An identifiable part of the whole
  • Components are possibly
  • Replaceable
  • Interchangeable
  • A means of supplying variation
  • They are only a part, not the whole

3
What Are Components?
  • Examples of components
  • Light bulb
  • Lego blocks
  • Hard disk
  • 35 mm Film
  • All of these are replaceable but which of these
    are interchangeable that is, which provides
    variation?

4
Why Use Components?
  • Components simplify the process of building
    systems
  • Promote reuse of both design and implementation
  • Allow specialization
  • Camera manufacturers need not also make films
  • Can the ideas of components be successfully
    applied to developing software?

5
What Are Software Components?
  • Software components are binary units of
    independent production, acquisition and
    deployment that interact to form a functioning
    system.
  • - Szyperski, C., Component Software
    Addison-Wesley, 1998

6
What Are Software Components?
  • A software component is a unit of composition
    with contractually specified interfaces and
    explicit context dependencies only.
  • Context Dependencies
  • Required interfaces
  • Execution platform
  • - Szyperski, C., Component Software
    Addison-Wesley, 1998

7
What Are Software Components?
  • A component is a physical and replaceable part
    of a system that conforms to and provides the
    realization of a set of interfaces.
  • - Jacobson, J., Booch, G., Rumbaugh, J., The
    Unified Software Development Process
    Addison-Wesley, 1999

8
Interfaces
  • A surface regarded as the common boundary to two
    bodies or spaces.
  • - Macquarie Dictionary 1985
  • An interface is a point of contact
  • Interfaces are contracts with rights and
    obligations for both sides

9
What Are Interfaces?
  • Hard disk
  • IDE, SCSI
  • Electrical PowerPoint
  • TV, Radio, Laptop, Light, Microwave
  • Variations exist
  • USA, Australian, British

10
What Are Software Interfaces?
  • Abstraction of a service that only defines the
    operations supported by that service (publicly
    accessible variables, procedures or methods) but
    not their implementation.
  • - Szyperski, C., Component Software
    Addison-Wesley, 1998

11
What Are Interfaces?
  • Interfaces are often described using an Interface
    Definition Language (IDL)
  • IDLs are programming-language independent
  • Which is more important, the component or its
    interface?

12
What Is Component Based Development
  • CBD is the creation and deployment of
    software-intensive systems assembled from
    components, as well as the development and
    harvesting of such components.
  • - Jacobson, J., Booch, G., Rumbaugh, J., The
    Unified Software Development Process
    Addison-Wesley, 1999

13
Software Component Technologies
  • Microsofts Component Object Model (COM)
  • Suns Enterprise Java Beans
  • CORBA and CORBAs Components
  • EJB is a compliant implementation
  • Microsofts .NET Framework

14
Issues Involved in CBD
  • Issues can occur because of
  • Differing machine architectures
  • Word sizes
  • Programming languages
  • OO, Functional, Imperative
  • Operating systems
  • Different instruction sets

15
Solutions
  • Common Type System
  • Standardized types and user defined types
  • Metadata Information
  • IDL files
  • Reflection
  • Common Execution Semantics
  • Cross language method invocation, COM and CORBA
  • Virtual Machines

16
Common Type System
  • What is an integer?
  • C/C Sequence of bits
  • SmallTalk A class
  • Java Both (int/integer)
  • IDLs normally define an integer type which is
    mapped into specific programming languages
  • Some languages define a standard size across
    machine boundaries

17
Metadata Information
  • Sharing binary components requires that
    developers can inspect components to find
    information about their functionality.
  • Two methods are normally used to describe
    metadata
  • IDL files (COM/CORBA)
  • Reflection (SmallTalk/Java/.NET)
  • However, Reflection is normally not used across
    language boundaries.

18
Execution Semantics
  • Need to abstract about elements of execution,
    such as
  • Calling semantics
  • Object Models
  • Data Access

19
Execution Semantics
  • Method call level
  • COM/CORBA
  • Object models
  • Interface based, COM/CORBA
  • Full-language semantics
  • SmallTalk, Java, .NET (but this is often language
    specific)

20
What Are Interfaces?
  • If interfaces are the publicly exposed methods
    that a client can call on a server, how do
    clients obtain the specification of these
    interfaces?

21
Accessing Information About Interfaces
  • Component architectures generally use one of two
    methods to provide information about interfaces
  • An abstract Interface Definition Language
  • Which is a separate file to the definition of the
    component implementing the interface
  • Is common in multi-language systems
  • The interface may be defined by the actual
    definition of the component

22
What Are IDLs?
  • Used to define an interface according to a
    certain model (usually an object model) in a
    programming language-neutral form.
  • - Szyperski, C.,Component Software
    Addison-Wesley, 1998
  • IDLs specify contracts

23
What Are Contracts?
  • Specification attached to an interface that
    mutually binds the clients and providers
    (implementers) of that interface. Contracts can
    cover functional and non-functional aspects.
  • - Szyperski, C.,Component Software
    Addison-Wesley, 1998
  • Functional Syntax and Semantics
  • Non-functional Quality of service

24
Accessing Information About Interfaces
  • In IDL-based systems
  • Interfaces are described in a programming-language
    - independent Interface Definition Language (IDL)
  • An IDL compiler processes an IDL file generating
    metadata about the interface
  • COM Type Library
  • CORBA Interface Repository

25
IDLs Provide
  • IDLs need to provide
  • Type System
  • Support of the generation of Metadata
  • Language Interoperability
  • Normally only cross-language method calls are
    available
  • .NET provides cross-language inheritance

26
Why Provide a Type System?
  • What is an integer?
  • C/C Sequence of bits
  • SmallTalk A class
  • Java Both (int/integer)
  • IDLs normally define an integer type which is
    mapped into specific programming languages

27
Metadata Information
  • Sharing binary components requires that
    developers can inspect components to find
    information about their functionality
  • IDLs are normally used to generate metadata
  • Compiled IDL files (a components Metadata) is
    stored in
  • Type Libraries (COM)
  • Interface Repositories (CORBA)

28
Execution Semantics
  • IDLs can generate proxy objects which permit
    cross language method calls.

29
Non-IDL-Based Systems
  • Java and .NET do not use an IDL, instead the
    interfaces are defined along with the definition
    of the components in a programming language
  • This eliminates the need for an IDL compiler but
    places more requirements on the language compiler

30
Architecture
  • Overall design of a system. An architecture
    integrates separate but interfering issues of a
    system, such as provisions for independent
    evolution and openness combined with overall
    reliability and performance requirements.
  • Szyperski, C.,Component Software
    Addison-Wesley, 1998

31
Architecture
  • An architecture defines guidelines that together
    help to achieve the overall targets without
    having to invent ad hoc compromises during system
    composition. An architecture must be carefully
    evolved to avoid deterioration as the system
    itself evolves and the requirements change.
  • Szyperski, C.,Component Software
    Addison-Wesley, 1998

32
Architecture
  • The right architectures and properly managed
    architecture evolution are probably the most
    important and challenging aspects of component
    based software engineering.
  • Szyperski, C.,Component Software
    Addison-Wesley, 1998

33
Software Component Technologies .NET
Architecture
34
.NET Framework Architecture
System.Web
System.WinForms
Controls
Drawing
Web Services
Web Forms
Windows Application Services
ASP.NET Application Services
System Base Framework
ADO.NET
XML
SQL
Threading
IO
Net
Security
ServiceProcess
Common Language Runtime
Metadata
Type System
Execution
35
System
  • Provides basic and fundamental .NET types and
    services, such as
  • System.Object
  • System.Type
  • Most applications will be created using higher-
    level abstractions in the Framework.
  • However, all functionality provided by the
    Framework is built on top of this functionality
    for example, much of the .NET functionality
    depends on Reflection.

36
System
  • ...
  • static int Main(string args)
  • System.String s "Hello World!"
  • System.Type t s.GetType()
  • System.Console.Out.WriteLine(t.ToString())
  • return 0

37
System
38
System.Reflection
  • Provides types that allows programs to
    dynamically
  • Inspect the Type System
  • Extend the Type System (create new types at
    runtime)
  • Create instances and invoke methods on types

39
System.Reflection
  • using System
  • using System.Reflection
  • namespace Damien
  • public class TypeInfo
  • public static void Main(String args)
  • ...

40
System.Reflection
  • public static void Main(String args)
  • Type t Type.GetType("System.String")
  • Console.WriteLine(t.FullName)
  • Console.WriteLine(t.AssemblyQualifiedName)
  • Console.WriteLine(t.BaseType)
  • MethodInfo ma t.GetMethods()
  • for(int i 0 i lt ma.Length i)
  • Console.WriteLine(mai)

41
System.Reflection
  • Object a new Object1
  • a0 "Hello World"
  • Object o Activator.CreateInstance(t, a)
  • Type p new Type2
  • p0 Type.GetType("System.Int32")
  • p1 Type.GetType("System.String")
  • MethodInfo m t.GetMethod("Insert",p)

42
System.Reflection
  • Console.WriteLine("Invoking this method")
  • Console.WriteLine(m)
  • a new Object2
  • a0 0
  • a1 "Hello World "
  • Console.WriteLine(m.Invoke(o, a))

43
System.Reflection
  • using System
  • using System.Reflection
  • using System.Text
  • AttributeUsage(AttributeTargets.ClassMembers,
  • AllowMultiple true)
  • public class AuthorAttribute System.Attribute
  • public String Author
  • ...

44
System.Reflection
  • public class AuthorAttribute System.Attribute
  • public String Author
  • public AuthorAttribute(String Author)
  • this.Author Author
  • override public String ToString()
  • return new StringBuilder("Author "
  • Author).ToString()

45
System.Reflection
  • Author("Damien Watkins")
  • class ProgrammingAssignment
  • Author("Mark Hammond")
  • public ProgrammingAssignment()
  • Console.WriteLine("Constructor")
  • public static void Main()
  • ...

46
System.Reflection
  • public static void Main()
  • Type t Type.GetType("ProgrammingAssignment")
  • Console.WriteLine(t.AssemblyQualifiedName)
  • Object Attributes t.GetCustomAttributes()
  • Console.WriteLine("Number of attributes is
  • Attributes.Length)
  • for (int i 0 i lt Attributes.Length i)
  • Console.WriteLine(Attributesi)
  • ...

47
System.Collections
  • Provides basic collection types, such as
  • System.ArrayList
  • System.Hashtable
  • System.Stack
  • Unfortunately, these structures are based on
    System.Object.
  • There is a real need for true generics!

48
System.Collections
  • Hashtable ht new Hashtable()
  • ht.Add( "Apple", "Green" )
  • ht.Add( "Oragne", "Orange" )
  • ht.Add( "Green", "Grape" )
  • Console.WriteLine("Number of items "
  • ht.Count)
  • IDictionaryEnumerator e ht.GetEnumerator()
  • while(e.MoveNext())
  • Console.WriteLine("Key " e.Key
  • "Value " e.Value )

49
.NET Framework Architecture
System.Web
System.WinForms
Controls
Drawing
Web Services
Web Forms
Windows Application Services
ASP.NET Application Services
System Base Framework
ADO.NET
XML
SQL
Threading
IO
Net
Security
ServiceProcess
Common Language Runtime
Metadata
Type System
Execution
50
Base Framework
  • Contains a number of classes that generally
    provide an abstraction that covers an area of
    programming
  • For example, System.Threading provides an
    abstraction of writing multi-threaded programs
    that can be used across languages

51
System.Threading
  • using System
  • using System.Threading
  • class ThreadClass
  • public void StartHere()
  • Console.WriteLine("Thread starting")
  • Thread.Sleep(0)
  • Console.WriteLine("Thread ending")
  • ...

52
System.Threading
  • public static int Main()
  • Console.WriteLine("Main Thread started")
  • ThreadClass tc new ThreadClass()
  • Thread t new Thread(
  • new ThreadStart(tc.StartHere))
  • t.Start()
  • ...

53
System.Threading
  • Console.WriteLine("t has been started")
  • Thread.Sleep(0)
  • while (
  • (t.ThreadStateThreadState.Unstarted)!0)
  • Console.WriteLine("Main Thread ending")
  • return 0

54
System.ComponentModel
  • Provides .NET types that support the Component
    Model, such as
  • Component
  • Attributes
  • Type Conversions

55
System.ComponentModel
  • AttributeCollection ac TypeDescriptor.GetAttribu
    tes(button1)
  • BrowsableAttribute a BrowsableAttribute.Yes
  • if(ac.Contains(a))
  • MessageBox.Show("Browsable")
  • else
  • MessageBox.Show("Not Browsable")

56
System.ComponentModel
  • using System
  • using System.ComponentModel
  • ...
  • BooleanConverter b new BooleanConverter()
  • String s "false"
  • if(b.CanConvertTo(s.GetType()))
  • Object o b.ConvertFrom(s)
  • Console.Out.WriteLine(o)

57
System.XML
  • using System
  • using System.Xml
  • using System.Xml.Serialization
  • using System.IO
  • public class Name
  • ...

58
System.XML
  • public class Name
  • public Name()
  • public Name(string Family, string Given)
  • this.Family Family
  • this.Given Given
  • public string Family
  • private string Given

59
System.XML
  • public class Test
  • public static int Main()
  • Name Damien new Name("Watkins", "Damien")
  • XmlSerializer XMLoutput
  • new XmlSerializer(Damien.GetType())
  • StringWriter sw new StringWriter()
  • XMLoutput.Serialize(sw, Damien)
  • Console.WriteLine(sw.ToString())
  • return 0

60
System.Data.ADO
  • ADOConnection myConnection new
    ADOConnection("Provider ")
  • ADODataSetCommand myCommand new
    ADODataSetCommand("SELECT ", myConnection)
  • DataSet ds new DataSet()
  • myCommand.FillDataSet(ds, "Subjects")
  • Subjects.DataSource ds.Tables0.DefaultView
  • Subjects.DataBind()

61
.NET Framework Architecture
System.WinForms
System.Web
Web Services
Web Forms
Controls
Drawing
ASP.NET Application Services
Windows Application Services
System Base Framework
ADO.NET
XML
SQL
Threading
IO
Net
Security
ServiceProcess
Common Language Runtime
Metadata
Type System
Execution
62
ASP.NET
  • Provides a means of exposing the .NET Framework
    and its functionality to the WWW
  • Contains a number of pre-built types that take
    input from .NET types and represents them in a
    form for the web (such as HTML)

63
ASP.NET
  • In the following example, a DataList, named
    studentList
  • Takes its input from a C array object, which is
    located in a C file
  • Displays it on a aspx page in HTML

64
ASP.NET
  • ltaspDataList runatserver
  • id"studentList"
  • RepeatColumns"2"
  • RepeatDirection"Vertical"
  • RepeatMode"Table"
  • Width"100"gt
  • ...
  • lt/aspDataListgt

65
ASP.NET
  • ltaspDataList runatserver ...
  • ltproperty name"AlternatingItemStyle"gt
  • ltaspTableItemStyle BackColor"yellow"/gt
  • lt/propertygt
  • lttemplate name"ItemTemplate"gt
  • ltaspPanel runatserver font-size"12pt
  • font-bold"true"gt
  • lt ((Student)Container.DataItem).Name gt
  • lt/aspPanelgt
  • ltaspPanel runatserver font-size"12pt"gt
  • lt ((Student)Container.DataItem).Number gt
  • lt/aspPanelgt lt/templategt

66
Web Services
  • Web Services also provides ameans to expose .NET
    functionality on the web but Web Services expose
    functionality via XML and SOAP

67
System.Web.Services
  • namespace WebServiceDemo
  • ...
  • using System.Web.Services
  • public class WebService1 System.Web.Services.W
    ebService
  • WebMethod
  • public string HelloWorld()
  • ...

68
.NET Framework Architecture
System.Windows
System.Web
Controls
Drawing
Web Services
Web Forms
Windows Application Services
ASP.NET Application Services
System Base Framework
ADO.NET
XML
SQL
Threading
IO
Net
Security
ServiceProcess
Common Language Runtime
Metadata
Type System
Execution
69
System.WinForms
  • Provides .NET types for building Windows
    Applications
  • System.WinForms.Form

70
System.Windows
  • namespace Test
  • using System
  • ...
  • using System.WinForm.Forms
  • public class Form1
  • System.WinForm.Forms.Form
  • private System.Windows.Forms.Button b1

71
Summary
  • There are too many classes to cover them all!
  • Recommendation When you need to add some
    functionality into your application, look in the
    Architecture.
Write a Comment
User Comments (0)
About PowerShow.com