Вы находитесь на странице: 1из 65

Component-Based Development

Ben Fairfax
Thursday 21st September 2006
Preface

This is a supplementary article for the presentation:

Title: Component-Based Development (CBD)


Speaker: Ben Fairfax
Time: 6:30pm, Thursday 21st September 2006
Location: Hilton Hotel, Douglas, Isle of Man
Web: http://www.webcabcomponents.com/iom/talks/

The guide is divided into the following four parts:

• Introduction - Introducing CBD, Business Components and Component Packages

• Modern Component Platforms - Describing the features of the Excel, Delphi,


.NET, J2SE and J2EE Component Development Platforms.

• Using Components - Details with practical examples how Components can be


used.

• Making Components - Efficient and robust development procedure for the creation
of multi-platform Component Packages.

Please note that all the Client Examples, Example Component Packages and associated
Build system source files can be downloaded from the directory:

http://www.webcabcomponents.com/iom/development/examples/

If you have any feedback or queries regarding this guide this please feel free to contact
us via email or on-line at:

support@WebCabComponents.com

http://www.webcabcomponents.com/support/

The WebCab Components Team

i
Synopsis

0.1 Details
Title: Component-based Development
Speaker: Dr Ben Fairfax
Organizer: British Computre Society (BCS) Isle of Man Branch
Time: 6:30pm (6pm Doors Open), Thursday 21st September 2006
Location: Shearwater Suite, Hilton Hotel, Douglas, Isle of Man

0.2 Overview
A Software Component (i.e. DLL or JAR) is a piece of technical or business functionality
embedded within a self-contained software artifact which can be re-used across an organ-
isation or industry. The value of Software Components is that they enable the re-use of
software which leads to significant reductions in the cost, time and expertise required in
order to undertake a given software development project.

Topics Covered

• Introduction: What are Business Software Components? How Components turn


business domain experts into programmers and programmers into business domain
experts?

• Modern Component platforms: Which platforms support components and how?


The advantages and disadvantages of the various platforms?

• Using Components: How to use a Component within the three generic types of
client application?

• Making Components: How can an existing development team most efficiently start
creating re-usable software component packages? Here we will detail many aspects
of our internal development process and build systems which have been refined over
a number of years which enable a team to efficiently create multi-platform software
component packages.

ii
Synopsis Chapter 0

0.3 About the Speaker


Ben is originally from West Sussex (England) and was educated at the Universities of
London, Cambridge and MIT (US). After completing his PhD in Mathematics in 1999,
Ben founded WebCab Components a software Component vendor in Bucharest, Romania.
In April this year he relocated himself, and his business to the Isle of Man and continues
to develop Component Based Software solutions.

0.4 Web Links


• Component-Based Development Homepage - http://www.webcabcomponents.com/iom/talks/

• British Computer Society (Isle of Man Branch) - http://www.isleofman-bcs.org/

• Forthcoming Events Isle of Man BCS


http://www.isleofman-bcs.org/isle of man bcs forthcoming events.aspx

iii
Contents

Preface i

Synopsis ii
0.1 Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
0.2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
0.3 About the Speaker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
0.4 Web Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii

I Introduction 1
1 What is Component-Based Development (CBD)? 2
1.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.1 Enable Software Re-use . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.2 Build Software by assembling blocks . . . . . . . . . . . . . . . . . 3
1.2.3 Why bother? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Examples of Formal Definitions . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.1 Dr Szyperski . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 Historical Context and Motivation for CBD? 5


2.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2.1 Bill Gates: Re-using Code . . . . . . . . . . . . . . . . . . . . . . . 5
2.2.2 High overhead costs in re-using business intelligence presented (solely)
as text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.3 Quantitative techniques in Business . . . . . . . . . . . . . . . . . . 6

3 What is a (Business) Component? 7


3.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2.1 No Main Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2.2 Properties of Components . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.3 Associated Component Platform . . . . . . . . . . . . . . . . . . . . 8
3.2.4 Business Components . . . . . . . . . . . . . . . . . . . . . . . . . . 8

iv
CONTENTS CONTENTS

4 What are (Business) Component Packages? 9


4.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2.1 Components Packages must haves . . . . . . . . . . . . . . . . . . . 9
4.2.2 Component Packages should haves . . . . . . . . . . . . . . . . . . 10
4.2.3 Component Packages Extras . . . . . . . . . . . . . . . . . . . . . . 10
4.2.4 Cost, Advantages of making Packages . . . . . . . . . . . . . . . . . 10

5 Empowering Users, Developers and Organizations 12


5.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.2.1 Pyramid Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5.2.2 Hide IT Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.2.3 Hide Business Complexity . . . . . . . . . . . . . . . . . . . . . . . 13
5.2.4 Manageable Development . . . . . . . . . . . . . . . . . . . . . . . 13

II Modern Component Platforms 14


6 Types of Component Platforms 15
6.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.2.1 Early Implementation . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.2.2 Tool Based Platforms . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.2.3 Managed Platforms/Managed Software . . . . . . . . . . . . . . . . 16
6.2.4 Vendors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

7 Excel and XML Web service Platforms 18


7.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7.2.1 Cannot Send Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7.2.2 Limited Support of State . . . . . . . . . . . . . . . . . . . . . . . . 18
7.2.3 Close Integration and Familiar User Experience . . . . . . . . . . . 19

8 .NET and the J2SE Platform 22


8.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.2.1 Similar Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8.2.2 User Session Management . . . . . . . . . . . . . . . . . . . . . . . 22
8.3 J2SE Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8.4 .NET Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

v
CONTENTS CONTENTS

9 J2EE Platform and EJBs 26


9.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.2.1 Full Enterprise Functionality . . . . . . . . . . . . . . . . . . . . . . 26
9.2.2 Complexity and Cost . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.2.3 Comparison between the J2EE and .NET Platforms . . . . . . . . . 27

III Using Components 28


10 The Internet changed everything 29
10.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
10.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
10.2.1 Distribution of Business intelligence Software Artifacts . . . . . . . 29
10.2.2 Internet Enabled Communication . . . . . . . . . . . . . . . . . . . 30
10.2.3 Iterative Development and Feedback . . . . . . . . . . . . . . . . . 30

11 Three Generic Types of Business Components 31


11.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
11.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

12 Three Generic Clients of Sum Component 32


12.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
12.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
12.2.1 Stateless Sum Component with Stateless Client . . . . . . . . . . . 32
12.2.2 Statefull Sum Component with Statefull Client . . . . . . . . . . . 33
12.2.3 Statefull/Helper Type Sum Components with Client . . . . . . . . 34

13 Three Generic Clients of Curve Fitting Components 35


13.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
13.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
13.2.1 Stateless Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
13.2.2 Stateful Client for fitting y = a0 (1 + 3x + 4x2 ) = a1 Cos(2x + 1) . . 36

IV Making Components 41
14 Build Strategies 42
14.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
14.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
14.2.1 Consider Complete Life cycle . . . . . . . . . . . . . . . . . . . . . 42
14.2.2 Separate IT, Business Aspects . . . . . . . . . . . . . . . . . . . . . 42
14.2.3 Multi-platform Approach . . . . . . . . . . . . . . . . . . . . . . . . 43
14.2.4 Automate as much as possible . . . . . . . . . . . . . . . . . . . . . 44

vi
CONTENTS CONTENTS

15 Multi-platform Build System Aspects 45


15.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

16 Notion of ‘Super Docs’ 46


16.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
16.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
16.2.1 Super Documentation . . . . . . . . . . . . . . . . . . . . . . . . . 46
16.2.2 SumStateless.java Super Docs . . . . . . . . . . . . . . . . . . . . . 47
16.2.3 SumStateful . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

17 Multi Platform QA Client System 49


17.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
17.2 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
17.2.1 ‘XML’ Mark-up of SumStateless Client . . . . . . . . . . . . . . . . 49
17.2.2 SumStatefulClient.xml . . . . . . . . . . . . . . . . . . . . . . . . . 49

18 Code Wrappers and Generated Aspects 51


18.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

19 .NET Package Structure 52


19.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

20 J2SE Package Structure 53


20.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

21 Build System Input Files 54


21.1 Items of Slide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
21.2 Download Location of CBD Example Source Files . . . . . . . . . . . . . . 54
21.3 Description of Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
21.3.1 C# Source Code File of SumStateless . . . . . . . . . . . . . . . . . 54
21.3.2 C# Source Code File of SumStateful . . . . . . . . . . . . . . . . . 55
21.3.3 C# Source Code File of SumWithHelperType . . . . . . . . . . . . 56

vii
Part I

Introduction

1
Chapter 1

What is Component-Based
Development (CBD)?

1.1 Items of Slide


• Enable Software Re-use - CBSE consists of Domain Engineering and CBD

• Build software by assembling blocks - Analogy: Hi-Fi System

• Why bother? - Lower cost, high quality, lower knowledge barrier

1.2 Description of Items


1.2.1 Enable Software Re-use
The key rationale of Component-Based Development (CBD) is to enable the systematic
re-use of software artifacts. CBD itself falls within the wider software re-use domain of
Component-Based Software Engineering (CBSE) which encompasses two parallel engineer-
ing activities:
• Domain Engineering - Explores an Applications Domain with the specific intent
of finding functional, behavioral, and data components that are candidates for re-use.
These components are placed in reusable libraries. Within this presentation we will
not really deal with the topic of domain engineering which is specific to each subject
domain (i.e. finance, oil industry, shipping, retail etc). However, I wish to point out
that even though I am not going to attempt to cover this topic it is not because I do
not consider it to be a considerable interest. At present, the topic of is under active
development and promotion and for interested parties I recommend the sites:

– General Ideas: Domain Engineering: A Model-Based Approach:


http://www.sei.cmu.edu/domain-engineering/domain engineering.html
– Attempt to Formalize: Business Process Modeling Notation (OMG):
http://www.bpmn.org/

2
What is Component-Based Development (CBD)? Chapter 1

– Specific Domain: OMG’s Finance DTF:


http://fdtf.omg.org/
– Useful Tools: Domain-Specific Language Tools at MSDN:
http://msdn.microsoft.com/vstudio/DSLTools/

• CBD - Elicits requirements from the user, selects an appropriate architectural plat-
form and style to meet the objectives of the system to be built, and then:

– Select: Select potential components for reuse


– Qualify: Qualifies the components to be sure that they property fit the archi-
tecture for the system
– Adapt: Adapts components if modifications must be made to properly integrate
them
– Integrate: Integrates the components to form subsystems and the application
as a whole

Often not all the functionality required will exit within pre-existing components and
hence custom components will need to be developed to address those aspects of the
system that cannot be implemented using existing systems.

1.2.2 Build Software by assembling blocks


The use of CBD in software can be seen as an analogous activity to the use of “components”
in the use and distribution of an Hi-Fi system. In particular, it only takes a few minutes to
assemble a stereo system because the components are designed to be integrated with ease.
Although software is considerable more complex, it follows that component-based systems
are easier to assemble and therefore less costly to build than systems constructed from
discrete parts. Moreover, the fact that the discrete parts are hidden from view and the
interfaces are clearly defined, makes it quicker and easier the connect up the components.

1.2.3 Why bother?


• Lower Cost: The cost saving result for the re-use of code and the fact that it is
easier the assemble component as opposed to ‘cut and paste code’.

• High Quality: CBSE encourages the use of standard software infrastructure (.NET
IIS Stack, J2EE App Server, Tomcat/Spring, Excel) and predictable architectural
patterns thereby leading to a higher quality result.

• Lower Knowledge Barrier: By hiding the discrete parts and only exposing well
defined interfaces, the user only need to know what functionality is required, not how
that functionality is constructed. The remark means that the programmer does not
need to know the nature of an algorithm, and a business user does not need to know
the details the technology infrastructure.

3
What is Component-Based Development (CBD)? Chapter 1

1.3 Examples of Formal Definitions


1.3.1 Dr Szyperski
Clemens Szyperskis book, Component Software: Beyond Object-Oriented Programming,
has the following definition of components (see page 34):

A software component is a unit of composition with contractually specified


interfaces and explicit context dependencies only. A software component can
be deployed independently and is subject to composition by third parties.

4
Chapter 2

Historical Context and Motivation


for CBD?

Here we detail the motivation and historical context of CBD from the point of view of:

• Developer - Primary focus is software development.

• Business User - Primary focus is not software development but applying specific
business intelligence (i.e. quantitative analyst, accounting etc).

2.1 Items of Slide


• Bill Gates, Chairman and Chief Software Architect, Microsoft, 1997:

“. . . the Industrial Revolution of software is finally upon us. Special-


ization of resources, standards for interchangeable parts, and streamlined
assembly tools have been used in other industries for hundreds of years
to speed the development of highly complex products. Despite their ubiq-
uity, application of these concepts to the modern software industry is just
beginning.”

• Re-using Business Intelligence - High overhead costs in re-using business intelli-


gence presented (solely) as text.

• Distributing Business Intelligence - Quantitative techniques in business (i.e.


banks) must be embedded in software.

2.2 Description of Items


2.2.1 Bill Gates: Re-using Code
Software development is a branch of engineering and yet even today the majority of soft-
ware projects are developed nearly entirely from scratch by writing source code, that is,

5
Historical Context and Motivation for CBD? Chapter 2

composing software from its base ingredient of source code. This contrasts completely from
other domains of engineering such as construction where the development of a house for
example consists solely of the assembling of pre-build components (bricks, tiles etc).

The reason why a housing builder uses pre-made components is that its significantly
cheaper, easier and agrees with the industry wide standards within the construction in-
dustry. The Components themselves are commodities and do not lead to competitive
differentiation of one house builder over another. A similar situation holds for all other
domains of engineering including software and within all of them there is no added value
created by ‘re-inventing the wheel’.

2.2.2 High overhead costs in re-using business intelligence pre-


sented (solely) as text
Personally I come from a science background and hence my original take on CBD came
very much from the angle of someone who wished to see higher and easier re-use of quan-
titative techniques. The sad reality is that science in particular is only easily accessible
to those with the relevant scientific training and hence the re-use of scientific techniques
has been traditionally limited to those organizations which have suitably qualified staff.
Moreover, the more specialized and sophisticated the techniques the corresponding less
re-use occurs since there are fewer people who have mastered the relevant techniques. In
particular, the average readership of a scientific article which appears within a scientific
journal is 2.3 people (excluded the referee).

The re-use of Business Intelligence distributed in text format needs to be completely un-
derstood and repackaged before the principles, ideas and techniques contained therein can
be re-used within other domains. This is an inherently inefficient approach. CBD plays
the role of presenting the Business Intelligence in a format (i.e. software, documentation
and examples) which is easier and more efficient to re-use within other domains by a wide
range of potential users.

2.2.3 Quantitative techniques in Business


Traditionally business intelligence in general and science in particular has been distributed
as written text. For modern businesses a quantitative technique is only useful once it
has been embedded within a piece of software. In short, if you cannot implement it, the
functionality cannot be used within the business and hence has no value to the host orga-
nization.

Within the quantitative fields this has been particularly apparent. Where at present
any Math or Physics PhD are in a situation where they must learn at least something
about programming in order to undertake potential careers in finance, corporate research
departments or software companies.

6
Chapter 3

What is a (Business) Component?

Here we detail a particular type of software component, namely a Business Components


which we will principally deal with in this presentation.

3.1 Items of Slide


• No Main Method: Components do not run and can only be accessed from client
applications.

• Properties of Components - Well defined Interfaces, Self-Contained, allows Com-


position.

• Associated Component Platform - Container in which the component is deployed


(no ’main’ method).

• Business Components - A Business Component offers non-graphical functionality


(ie black-box).

3.2 Description of Items


3.2.1 No Main Method
The primary characterization of a Software Component as opposed to a Software Appli-
cation is that a Software Component does not have a ‘Main method’. Recall that the
main method within a software application forms the starting point from where the Ap-
plication runs by stating the initial thread of execution. A Software Component on the
other hand does not have a ‘Main method’ and hence cannot be run in this sense. A Soft-
ware Component can only be used within a Client Application (which naturally contains a
main methods) which uses the functionality and/or data encapsulated within the Software
Component.

7
What is a (Business) Component? Chapter 3

3.2.2 Properties of Components


There is no agreed formal definition of what a component is however there are a number of
characteristics of components which are widely accepted as good practice. There include:

• Well defined Interfaces - The interfaces are the only means by which the function-
ality of the component can be accessed. Therefore the interfaces must be compre-
hensive in terms of accessing functionality, clearly documented and ideally intuitive.

• Self-Contained - The Component should not depend on any external resources


or libraries and should encapsulate completely a given piece of functionality. Such
encapsulation of functionality means that the components can be re-used within
differing situations where as a suitable component container exists.

• Composition - Since a component does not run in the sense of a standard application
(for example, console application) there most to a robust mechanism of composition.

3.2.3 Associated Component Platform


All modern component standards are associated with a component container in which the
component in question is deployed (for example, Microsoft Excel, Java Runtime Environ-
ment, .NET Framework redistributable package, J2EE Application Server). The distinct
advantage of having a container is that the container manages the instance of the com-
ponent. In particular, by assigning attributes to the component the container is able to
manage various run-time characteristics of the component (such as database connectivity,
Web service enable, caching etc).

3.2.4 Business Components


A business component is simply a component which does not offer graphical functionality.
We make this distinction since traditionally components (such as buttons, text areas) have
generally offered only graphical functionality.

8
Chapter 4

What are (Business) Component


Packages?

For a Component to be useful it is essential that it is distributed with artifacts in addition


to the DLL or JAR, such as sufficient documentation in order to known how to use it and
what functionality is available.

4.1 Items of Slide


• Component Packages must haves: Component (DLL, JAR etc), API documen-
tation.

• Component Packages should haves: Technical documentation, user cases/examples.

• Component Packages extras: Installer, Middleware packaging (WAR, EAR, ASP.NET).

• Costs and Advantages of making Packages: Higher cost, Higher Re-use, Higher
Asset Protection.

4.2 Description of Items


4.2.1 Components Packages must haves
In order for a user to know how to use a Component at the very least the user must be
provided with:

• Component: The Component itself.

• API documentation: Details the nature of the functionality offered, the signatures
including returned data type of all methods, interdependence of the methods.

9
What are (Business) Component Packages? Chapter 4

4.2.2 Component Packages should haves


Technical documentation: Technical documentation should tell the business user the
minimal information to deploy and use the components within standard applications types,
in addition for those not familiar with the business logic encapsulated within the component
an introduction to the business logic should be included.
User Cases/Examples: As we mentioned before components do not run and can only
be accessed from client applications. Hence, the minimal path to resistance in using a
component lies in the possibility for the user of a component package to adapt an existing
clients example. Therefore, the wider the range of the clients examples offered and the
closer these are to the actual possible user cases the ’less cost’ to the user in terms of time
in using the component.

4.2.3 Component Packages Extras


• Installer: Ideally the Component Package should be packages with an installer which
checks the deployment environment for any dependencies, self-deploys and registers
the components within the relevant containers, and provides the other associated
artifacts of the package for the deployment machine.

• Middleware Packaging: Various Component containers such as JSP containers


such as Apache Tomcat, and ASP.NET containers such as the Microsoft’s IIS Appli-
cation Server Stack, require that the Component is packages it a particular format
will additional proxy and meta data files. In order to allow the user to deploy and use
the Component out-of-the-box on such middleware the Component Package should
come with the Component already packaged with relevant proxy files, and meta data
files for such environments.

4.2.4 Cost, Advantages of making Packages


In short the more you are prepared to invest in the creation of a components package the
greater to vales to users, the less support will be required and the better the protection of
the intellectual assets of the organization. As with all costs an organization will need to
balance the costs of production which the value creation within the user base.

The long term advantages to an organisation of embedded it business intelligence within


Component Packages in terms of Intellectual Property protection should not be over looked.
Often when personnel leave an organization much of the business processes which they
have developed are lost by the organization. If these processes had been embedded within
’Software Component Packages’ an organization will have ownership of these processes in-
dependently of the individual and protect itself against the eventuality of the individual
leaving the organization. Similar remarks also apply to the need to just store (i.e. persist)
the ideas behind the business processes before they are just forgotten by the key staff
members who developed them.

10
What are (Business) Component Packages? Chapter 4

In order to ensure the long term sustainability of a wide scale Component Development
initiative within an organization it is necessary that the development team or department
who invest resources in the development of component packages receive credit (monetary,
business recognition etc) for this investment of time and effort.

11
Chapter 5

Empowering Users, Developers and


Organizations

A central part of the value of components is that they can hide the innate complexity of
the business intelligence and/or IT technologies to the users of the Component.

5.1 Items of Slide


• Pyramid Problem: Approx. 100M people can use Excel, 10M can program in
some language, 1M use J2EE platform.

• Hide IT Complexity: Standard Interfaces, Self-deployment, pre-made examples.

• Hide Business Complexity: Only need to know what I need, not how it is done.

• Manageable Development: Components allow development to be split into man-


ageable parts.

5.2 Description of Items


5.2.1 Pyramid Problem
What ever domain you are in as you gain greater experience and specialization, so the
number of people and organizations who can offer similar services or products reduces. In
a similar fashion, as the development skills and experience required of the user increases,
so the number of people with these skills drastically reduces. As an example of this phe-
nomenon the number of users who can use Excel (100M), can program in any language
(10M) and can effectively use J2EE (1M). Therefore, when ever wishing to develop a piece
of software which embeds business intelligence, it is important to stress that the simpler
the user experience and the less the technical requires on the user the larger the potential
user base will be.

12
Empowering Users, Developers and Organizations Chapter 5

As we will see by later the use of a ‘Component Production System’ (ie build system)
you are able to produce a range of software implementations from a relatively few software
artifacts. Hence, maximizing the potential user base while also allowing those which the
skills to take advantages of more powerful software development platforms.

5.2.2 Hide IT Complexity


• Standard Interfaces: On each platform the user of a component will only need to
‘program against the interfaces’. The interfaces allow access to the services end-points
and hides the often rather complex underlying object structure.

• Self-deployment: A component packages installer should install and pre-configure


the components, documentation and examples with ideally no human interaction,
which hides the complexity of the deployment process.

• Pre-made examples: By providing the user with pre-made examples client appli-
cations which run out-of-the-box it can even be the case that in order to adopt and
use the Components functionality via the pre-made Clients the user does not need
to know apriori how the write such a client.

5.2.3 Hide Business Complexity


Recall that the Component will offer various services interfaces which will describe ‘what
the Component does’ and may also describe in brief the technique by which the results
will be arrived at. However, when the developer knows the procedures used buy the Com-
ponents or not does not affect there ability to use the Component for the simple reason
that, in order to select the appropriate functionality within the component you only need
to know ‘what you need’, not ‘how the result will be arrived at’.

We illustrate this point later when we demonstrate Client applications using a Curve
Fitting Component.

5.2.4 Manageable Development


In the context of a larger software development project components allow the entire applica-
tion to be sub-divided into manageable parts where each components are a well defined set
of interfaces. After this process the development divides into many separate autonomous
code bases where each Component development team can concentrate on its own piece of
functionality and robustness of the required functionality which it can test via its compo-
nents interfaces.

Within a development team this serves the important role of clearly defining responsi-
bilities, and allowing each development team to solely concentrate on understand and
implementing its set of functionality and saving them the need to know details concerning
other parts sections of the development.

13
Part II

Modern Component Platforms

14
Chapter 6

Types of Component Platforms

6.1 Items of Slide


• Early Implementation: Microsoft’s COM Platform (C++/C/VB on Windows
95/NT).
• Tool Based Platforms: Delphi, Visual Studio, Office (Excel).
• Managed Platforms: .NET, .NET XML Web service, J2SE, J2EE.
• Declarative Approach: Managed software encourages AOP approach (incl. de-
ployment descriptors, meta data).
• Vendors: J2SE/J2EE (IBM, Sun, Oracle, BEA) vs .NET (Microsoft).

6.2 Description of Items


6.2.1 Early Implementation
The earliest implementation of a component platform for reusable components was the
COM platform of Microsoft. Microsoft’s COM (Component Object Model) technology
in the Microsoft Windows-family of Operating Systems enables software components to
communicate. COM is used by developers to create re-usable software components, link
components together to build applications, and take advantage of Windows services. The
family of COM technologies includes COM+, Distributed COM (DCOM) and ActiveX
Controls.

Links: COM Homepage:


http://www.microsoft.com/com/default.mspx

COM and .NET are complementary development technologies


The .NET Common Language Runtime provides bi-directional, transparent integration
with COM. This means that COM and .NET applications and components can use func-

15
Types of Component Platforms Chapter 6

tionality from each system. For new development, Microsoft recommends .NET as a pre-
ferred technology because of its powerful managed runtime environment and services.

Links:

Calling a .NET Component from a COM Component


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp

Calling COM Components from .NET Clients


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callcomcomp.asp

6.2.2 Tool Based Platforms


A tool in some sense manages the user experience and though introducing a lack of flex-
ibility are easy to use, and generally efficient at quickly producing an client application.
For these reasons tools present a very convenient environment in which to offer business
intelligence to business users.

A Software Components is offered as a tool extension or add-in in the case of Excel. The
notion of a tool extension or add-in is essentially universal across all development tools
where each tool has its own extension integration API. By far the most popular tool in use
by Business Users and programmers for quantitative modeling and analysis is Microsoft’s
Excel which support a tightly integrated add-in development framework.

6.2.3 Managed Platforms/Managed Software


All modern component platforms are managed meaning that the components run inside
a container which manages the life-cycle of the software components. The container also
manages the interaction between client applications and the component. In the earlier
COM platform the OS itself managed the Component Life-cycle, but in modern platforms
the Container is run on the OS allows for example the container itself to be managed by
the OS (i.e. it can be rebooted without rebooting the OS).

Declarative Approach
Since the software is managed by a container it allows aspects such as data source, caching
framework and other technology Aspects to be assigned via meta data files by the container.
For example, in the case of J2EE Application service the EJB Component contains a
deployment descriptor which is an Application server specific XML compliant meta data
file which describes the nature of the Component and the services which are to be provide
by the Container to the component during run-time.

16
Types of Component Platforms Chapter 6

6.2.4 Vendors
Both the Java and .NET platforms are supported by the major developers and it is expected
that the relative use of these platforms will be roughly 50/50.

17
Chapter 7

Excel and XML Web service


Platforms

Though it is possible to use state and user define types on the Office Excel and XML Web
service platforms the developer expectations and ethos does not encourage this.

7.1 Items of Slide


• Cannot send Objects: Both platforms do not naturally support user defined types.

• Limited Support of State: Excel can support state, Web service can use of cookies.

• Close Integration and Familiar User Experience

7.2 Description of Items


7.2.1 Cannot Send Objects
Though it is possible to send and receive user defined types (i.e. objects) using the Office
or Web service platforms the ethos of these development platforms does not really support
this. In particular, on the Excel platform a user defined type would need to be written in
VBA and used within a VBA module. With XML Web services though there have been
attempts there is no established means by which an arbitrary object can be serialized as
XML and sent over the wire.

7.2.2 Limited Support of State


Similarly the user of Excel is not used to thinking is terms of state and there is no out-
of-the box support for State on the Excel platform. Saying this, State can be replicated
between a .NET Component which uses the .NET Interop API to interact with Excel using
the following schema:

18
Excel and XML Web service Platforms Chapter 7

• Make a call to a ‘set’ method within the Excel environment, which to parsed to a
.NET call via the Interop API which assigns given private fields within an instance
of the .NET Component.

• When this occurs in order to preserve the state there is a call to the instance of the
Workbook from the Component which creates another hidden worksheet within the
workbook and writes the private fields to the workbook on line 1.

• The user of Excel calls another method from the Stateful service which first checks
the values of the private fields within the hidden workbook, set these values within
the .NET Components and calls desired method and so on.

Remark: These feature has not been implemented by ourselves and as far as I know
no one else has done this.

7.2.3 Close Integration and Familiar User Experience


Though the Excel platform does have some limitations to does provide an integration API
which allows close integration providing a familiar user experience as illustrated within the
follow screen shoits of WebCab XL.

Please note that WebCab XL (Community Edition) is freely available from the location:

http://www.webcabcomponents.com/office/

19
Excel and XML Web service Platforms Chapter 7

Fig: Excel Function wizard and integrated API documentation

20
Excel and XML Web service Platforms Chapter 7

Fig: Allows the inclusion of custom menu items.

21
Chapter 8

.NET and the J2SE Platform

The .NET and J2SE platforms are essentially the same in terms of functionality capacity
and many of the technologies which exist on one platform can a corresponding technology
on the other.

8.1 Items of Slide


• Similar Functionality: JSP ↔ ASP.NET, JDBC ↔ ADO.NET, Swing ↔ Windows
Forms.

• User Session Management: Client user sessions are not uniquely managed (Ex.
.NET and SQL 2005)

8.2 Description of Items


8.2.1 Similar Functionality
Maybe I could include the two slides of the .NET and J2SE platforms and highlight and
similarities.

8.2.2 User Session Management


The J2SE and .NET platforms do not replicate an instance of a components for each client
user session which uses a given components. This means is form language that the ap-
plication is not thread safe. Basically, for stateless session services this does not cause a
problem since the clients do not change the state of the deployment service. However, in
the case of a stateless service (i.e. 2 of the 3 types of service) a given client can change the
state of a service while it is being used by another client.

A good examples of this limitation is illustrated with the limitation that a .NET v2.0 com-
pliant components can be deployed to SQL Server 2005, however they are not considered
SAFE unless they only used static fields which are read only or constants. In particular,

22
.NET and the J2SE Platform Chapter 8

SQL Server 2005 will run the component in-process and potentially share classes/assemblies
between users, and so for safety needs to be strict with statics. So that there is not an
unpredictable communication route between concurrent activities all static fields will need
to be read only or constant.

The reason for the seemingly annoying limitation is precisely for of the last of management
of user sessions and the fact the component is not replication for each user session (please
note I am referring to replication of the business layer logic, that is, the component, not
the data management system).

You are able to deploy the components as an ‘unsafe assembly’ which may contain static
fields by using the UNSAFE attribute. That is, to deploy you input prompt:

CERATE ASSEMBLY nameOfDLL


FROM ’full path of DLL’
WITH PERMISSION_SET = UNSAFE

23
.NET and the J2SE Platform Chapter 8

8.3 J2SE Architecture

24
.NET and the J2SE Platform Chapter 8

8.4 .NET Architecture

25
Chapter 9

J2EE Platform and EJBs

9.1 Items of Slide


• Full Enterprise Functionality: User session management, scalability on all tiers,
designed for CBD.

• Complexity and Cost: Developers can be hard to find and can be expensive.

9.2 Description of Items


9.2.1 Full Enterprise Functionality
The J2EE platform is the most feature complete platform in which components can be
deployed.

9.2.2 Complexity and Cost


J2EE is widely used in institutions which have the technology needs and development teams
which are able to take advantage of this powerful platform. However, the platform has
traditionally been rather complex to use and as an indication of this the latest specification
EJB v3.0, is essentially and set of interfaces and standards which make it easier to get at
the functionality of the EJB v2.0 platform. In particular, they have designed a ‘POJO +
Build system’ approach to the development of EJBs which WebCab has been doing since
the release of EJB v1.0.

26
J2EE Platform and EJBs Chapter 9

9.2.3 Comparison between the J2EE and .NET Platforms

Reproduced with permission from Microsoft

27
Part III

Using Components

28
Chapter 10

The Internet changed everything

The internet has a huge effect on the software industry, the discovery and application of
business intelligence and the ecosystem of software service providers and vendors.

10.1 Items of Slide


• Internet Enabled Distribution - Distribution of Business intelligence Software
Artifacts

• Internet Enabled Communication - Callaborative Development Process, In-


stance global reach, Efficient distribution

• Iteractive Development and Feedback - Ease of communication encourages con-


tinuous user feedback, Ease of distribution allows rapid iterative development cycles.

10.2 Description of Items


10.2.1 Distribution of Business intelligence Software Artifacts
Whether the distribution and use of a software component happens across an organization
or acorss the world, internet based technologies enable components to be found, and dis-
tributed. The fact that all potential users can access in real time the latest Components
available on a internet or extranet site has had a major influence in the model by which
software in consumed.

The internet offers an unparralleled informatoin resource for the discovery and realisa-
tion of the need to use various Business Intelligence and technology aspects. Now almost
all information workers can Goggle! a topic and get details accurate information in real
time. This evolution has meant that for example sophisicated quantitative techniques have
become more widely used by the non-specialist.

To sum up the internet not only allows the distribution of Software Components but

29
The Internet changed everything Chapter 10

also the discovery and distribution of information (of third party information) concerning
the functionality contained within such Software Components.

10.2.2 Internet Enabled Communication


The internet enables a collaborative development process where two way communication
can take place over the development cycle of a given component asset assuring that the
features implemented are the features that the user base actually want.

Components are typically not mass market products and therefore the ability to easily
obtain global reach makes the development of specialised Component Packages commer-
cially viable. Moreover, easily obtaining global reach means a larger user base resulting in
the development costs being spread over the larger base and hence enhancing the value of
the software component ecosystem.

10.2.3 Iterative Development and Feedback


Though components undergo testing and usability studies during development. The nu-
merious development, deployment envoiroments and user case senarios cannot be covered
or even antiscipated by the original development team. However, due to the ease with
whish users can communicate with the original developers and the ease with which a
patch/fix/update/new release can be built and re-distributed using internet technologies
means that a rapid iterative deelopment process can be used.

30
Chapter 11

Three Generic Types of Business


Components

As mentioned before a Component can only be used from a Client application (since Com-
ponents do not run). Moreover, we have found that for a Business Component (collection
of Business logic, or Black-Box) there are only three types of generic client application
because there are only three generic types of Business Components, namely:

11.1 Items of Slide


• Stateless Session Bean/Component/Service: Double in, double out (i.e. state-
less, no helper types)

• Statefull Session Bean/Component/Service: Set state, then double in, double


out (i.e. stateful, no help types)

• Statefull with helper types Session Bean/Component/Service

11.2 Description of Items


The reason why there are three types of generic client application of Business Components
is because there are three generic types of Business Component themselves, namely:

• Stateless Bean/Component/Service

• Statefull Bean/Component/Service

• Stateless Bean/Componnet/Service which uses helper types

This may seem rather technical but I assure you that the realisation of these three types
of generic types of components client application really are very straight forward in there
application. In order, to demonstrate how straight forward it is we will code and run
examples of these three generic types of client application.

31
Chapter 12

Three Generic Clients of Sum


Component

Here we demonstrate the three generic client types corresponds to three Business Services
of the three generic Types (stateless, statefull, statefull with helper types). The source
code for these examples with the associted Component DLL can be download from:

http://www.webcabcomponents.com/iom/development/examples/SumClients.zip

In order to run the examples download the zip file onto a Windows machine which has the
.NET Runtime installed, unzip the file, then run the Compile.bat and then Run.bat scripts
contains within one of the three subdirectories associated with each of the client examples
provided below.

12.1 Items of Slide


• Stateless Sum Component with Stateless Client

• Statefull Sum Component with Statefull Client

• Statefull/Helper Type Sum Components with Client

• Download: http://www.webcabcomponents.com/iom/development/examples/SumClients.zip

12.2 Description of Items


12.2.1 Stateless Sum Component with Stateless Client
using System;

using WebCab.Libraries.Cbd.BusinessLogic;

32
Three Generic Clients of Sum Component Chapter 12

public class SumStatelessClient {


public static void Main( String[] args ) {

// Instantiate Component
SumStateless instanceOfSumStateless = new SumStateless();

// Here we evaluate the summ of two numbers.


double sum1 = instanceOfSumStateless.Sum(
20.0, // a
40.0 // b
);
}
}

12.2.2 Statefull Sum Component with Statefull Client


using System;

using WebCab.Libraries.Cbd.BusinessLogic;

public class SumStatefulClient {


public static void Main( String[] args ) {

// Instantiate Component
SumStateful instanceOfSumStateful = new SumStateful();

// Here we set A coefficient.


instanceOfSumStateful.SetA(
46.0 // a
);

// Here we set B coefficient.


instanceOfSumStateful.SetB(
26.0 // b
);

// Here we evaluate the summ of two numbers.


double sum1 = instanceOfSumStateful.GetSum(
);
}
}

33
Three Generic Clients of Sum Component Chapter 12

12.2.3 Statefull/Helper Type Sum Components with Client


Helper Type Implementation
using WebCab.Libraries.Cbd.BusinessLogicHelper;

public class SumFunction : Function{

public double GetValueAt (double a, double b) throws Exception {


return a+b;
}
}

Main Client Application using Helper Type


using System;

using WebCab.Libraries.Cbd.BusinessLogicHelper;

public class SumWithHelperTypeClient {


public static void Main( String[] args ) {

// Instantiate Component.
SumWithHelperType instanceOfSumWithHelperType = new SumWithHelperType();

// Create an Instance of the SumFunction.


SumFunction createFunction1 = new SumFunction(
);

// Here we evaluate the summ of two numbers.


instanceOfSumWithHelperType.SetFunction(
createFunction1 // Function
);

// Here we evaluate the summ of two numbers.


double sum1 = instanceOfSumWithHelperType.GetValueAt(
20.0, // a
40.0 // b
);
}
}

34
Chapter 13

Three Generic Clients of Curve


Fitting Components

Here we demonstrate the three generic clients in a more non-trivial setting to illustrate
again the three generic types of components and the associated client applications. The
source code for these examples with the associted Component DLL can be download from:

http://www.webcabcomponents.com/iom/development/examples/CurveFittingExamples.zip

In order to run the examples download the zip file onto a Windows machine which has the
.NET Runtime installed, unzip the file, then run the Compile.bat and then Run.bat scripts
contains within one of the three subdirectories associated with each of the client examples
provided below.

13.1 Items of Slide


• Stateless Client for fitting y = mx + c

• Stateful Client for fitting y = a0 (1 + 3x + 4x2 ) = a1 Cos(2x + 1)

• Stateful/Helper Types Client for fitting y = a0 Sin(a1 x) + a2 x

• Downlaod Source: http://www.webcabcomponents.com/iom/development/examples/CurveFit

13.2 Description of Items


13.2.1 Stateless Client
for fitting y = mx + c

35
Three Generic Clients of Curve Fitting Components Chapter 13

Source Code of the Client Implementation


using WebCab.Libraries.Statistics.Correlation;

public class CorrelationClient


{
public static void Main( string[] args ){

// Instantiate the Components


Correlation instanceOfCorrelation = new Correlation ();

//
// Here we construct the regression line of Y on X.
//
double[] regressionX1 = instanceOfCorrelation.LeastSquaresRegressionLineY(
new double[] {2.0,5.0,1.0,3.0,4.0,1.0,5.0,3.0,4.0,2.0}, // xValues
new double[] {50.0,57.0,41.0,54.0,54.0,38.0,63.0,48.0,59.0,46.0} // yValues
);

// The first and second coefficients of the regression line,


// Y(y) = d[0]*X+d[1]; for the data set considered.
//
System.Console.WriteLine( " " );
System.Console.WriteLine( " d[0] = " + regressionX1[0] );
System.Console.WriteLine( " d[1] = " + regressionX1[1] );
System.Console.WriteLine( " " );
}
}

13.2.2 Stateful Client for fitting y = a0 (1 + 3x + 4x2 ) = a1 Cos(2x + 1)


Source Code of the Client Implementation
using WebCab.Libraries.Statistics.CurveFitting;

public class GeneralLinearClient


{
public static void Main( string[] args )
{

// Instantiate the Component


GeneralLinearFactorModel instanceOfGeneralLinearFactorModel
= new GeneralLinearFactorModel ();

//

36
Three Generic Clients of Curve Fitting Components Chapter 13

// Here we add a sum of power terms


//
instanceOfGeneralLinearFactorModel.AddSumOfPowerTerms(
new double[] {1.0, 3.0, 4.0}, // powerTermsCoeff
new double[] {0.0, 1.0, 2.0} // powerTermsExponents
);

// Here we add a cosinus fuction to our basic function.


//
instanceOfGeneralLinearFactorModel.AddCosineSum(
new double[] {2.4}, // cosCoeff
new double[] {1.0}, // coeff
new double[] {0.0}, // constant
new double[] {1.0} // exponent
);

// Here we calculate the coefficients for each function from


// within the function of best fit.
//
double[] generalFit1 = instanceOfGeneralLinearFactorModel.SetGeneralFit(
new double[] {1.0, 2.0, 3.0, 4.0, 5.0}, // xDataPoints
new double[] {1.0, 2.0, 3.0, 2.0, 1.0}, // yDataPoints
new double[] {0.1, 0.5, 0.6, 1.0, 0.11}, // sigma
new double[] {1.0, 1.0}, // initialValue
new bool[] {true, true} // fit
);

// The coefficients of the function is best fit are:


//
System.Console.WriteLine( " " );
System.Console.WriteLine( " a_0 = " + generalFit1[0] );
System.Console.WriteLine( " a_1 = " + generalFit1[1] );
System.Console.WriteLine( " " );
}
}

Stateful/Helper Types Client


for fitting y = a0 Sin(a1 x) + a2 x

Source Code of Helper Type Implementation


using WebCab.Libraries.Statistics.CurveFitting;

37
Three Generic Clients of Curve Fitting Components Chapter 13

/// <summary>
/// Here we provide an implementation of the interface NonLinearFunctionBasis
/// for the function:
///
/// <p><code>y = f(x, a[0],a[1],a[2]) = a[0].Sin(a[1].x) + a[2].x</code></p>
/// </summary>
public class NonLinearSinus : NonLinearFunctionBasis {

//
// The default constructor of the class NonLinearFuncs.
//
public NonLinearSinus(){
}

/// <summary>
/// The implementation of the non-linear function:
///
/// <p><code>y = f(x, a[0],a[1],a[2]) = a[0].Sin(a[1].x) + a[2].x</code></p>
///
/// <p>which represents a non-linear regression model with model parameters
/// <code>a[0], a[1], a[2]</code> and a real variable <code>x</code>.
/// Therefore, the differential with respect the a[0], a[1] and a[2] is:</p>
///
/// <p><ol>
/// <li> <code>df/da[0] = Sin(a[1].x)</code>
/// <li> <code>df/da[1] = a[0].x.Cos(a[1].x)</code>
/// <li> <code>df/da[2] = x</code>
/// </ol></p>
/// </summary>
/// <param> evaluationPoint the point at which the function is evaluated.</par
/// <param> modelParameters a double array containing the values of the variab
/// coefficients.</param>
///
public double[] getValueAt (double evaluationPoint, double[] modelParameters)

// Instantiate an array of length equal to the number of model parameters


// plus 1 (for the real variable), which we will them populate and final r
//
double[] afunc = new double[3+1];

// df/da[0] = Sin(a[1].x)
//
afunc[0] = System.Math.Sin(modelParameters[1]*evaluationPoint);

38
Three Generic Clients of Curve Fitting Components Chapter 13

// df/da[1] = a[0].x.Cos(a[1].x)
//
afunc[1] = modelParameters[0]*evaluationPoint
*System.Math.Cos(modelParameters[1]*evaluationPoint);

// df/da[2] = x
//
afunc[2] = evaluationPoint;

// f(x, a[0],a[1],a[2]) = a[0].Sin(a[1].x) + a[2].x


//
afunc[3] = modelParameters[0]*System.Math.Sin(modelParameters[1]
*evaluationPoint) + modelParameters[2]*evaluationPoint;

return afunc;
}
}

Source Code of Main Client Implementation


using WebCab.Libraries.Statistics.CurveFitting;

public class SinusClient


{
public static void Main( string[] args )
{
// used components
NonLinearModel instanceOfNonLinearModel = new NonLinearModel();

// Here we instantiate an instance of an nonlinear function.


//
NonLinearSinus funcs = new NonLinearSinus(
);
// Here we set the nonlinear function
instanceOfNonLinearModel.SetNonLinearFunctionBasis(
funcs // o
);

// Here we call the nonlinear algorithm of the best fitting curve


//
double[] nonLinear1 = instanceOfNonLinearModel.GetNonLinearModel(
new double[] {1.0, 2.0, 3.0, 4.0}, // xData
new double[] {1.0, 4.0, 9.0, 16.5}, // yData
new double[] {0.1, 0.1, 0.1, 0.1}, // sigma

39
Three Generic Clients of Curve Fitting Components Chapter 13

new double[] {1.0, 1.0, 1.0}, // initialCoefficients


new bool[] {true, true, true} // variables
);

System.Console.WriteLine( " " );


System.Console.WriteLine( " Parameters of the best fit function are:" );
System.Console.WriteLine( " " );
System.Console.WriteLine( " a[0] = " + nonLinear1[0] );
System.Console.WriteLine( " a[1] = " + nonLinear1[1] );
System.Console.WriteLine( " a[2] = " + nonLinear1[2] );
System.Console.WriteLine( " " );
}
}

40
Part IV

Making Components

41
Chapter 14

Build Strategies

Here we detail general principles which we have adhered to in the development of our
Component Package build process. In order to illustrate the ideas within the Component
Package Build System we will extend on the Sum Components examples we considered
within the previous section and consider a ‘Sum Component Package’. Please note that
all the sources and builds of the Final Component Packages can be downlaoded from the
directory:

14.1 Items of Slide


• Consider Complete Life cycle: Release, updates and future releases.
• Separate IT, Business Aspects: Development Grid Phenomenon
• Multi-platform Approach: Use only agreed multi-platform data types.
• Automate as much possible: Generate code/docs, packages and web site.

14.2 Description of Items


14.2.1 Consider Complete Life cycle
The development of a Component Package build strategy must take into account the
demands and requirements of both the development and support teams over the entire life
cycle of the Component package. This life cycle will include an initial release, distribution,
update releases and new releases.

14.2.2 Separate IT, Business Aspects


In a similar fashion to the need to hide complexity (either technical or business) from the
user the build process should also contain the features that:

42
Build Strategies Chapter 14

• Hide IT Complexity: Hide as much as possible the IT complexity from development


team members who specialize in business intelligence.

• Hide Business Intelligence Complexity: Hide as much as possible the complexity of


the Business Intelligence from development team members who specialize within the
IT Aspects of the Component Packages.
The consequence of separating the Business Intelligence and Technology Platform Aspects,
is that by integrating these features via a build system, we obtain what I referred to as the
‘Development Grid Phenomenon’ in which a new Technology Aspects can be immediately
populated within all existing Business Intelligence modules and a new Business Intelligence
module is enhanced by all existing Technology Aspects. This process produces a grid like
range of Component Software Artifacts as illustrated below:

The point illustrated within the diagram is that if one new Business Intelligence Module
and one new technology aspect is included representing 50 percent additional development
time, then the build system as a whole will generate 9 software Component Artifacts rather
than 4, representing an increase of 125 percent in the output.

14.2.3 Multi-platform Approach


By restricting the data types which are used we are able to provide an implementation
of the Component Packages on a number of platforms using only a POJO type Java and
C sources. These platforms include: .NET Class Libraries, COM enabled .NET Class
Libraries, .NET XML Web services, Excel Add-in, Delphi COM Control, Delphi for .NET
Control, JavaBean/Java Class Library, EJB Components. The range of data types allowed
are:
int int[] int[][]
double double[] double[][]
bool bool[] bool[][]
String String[] String[][]
byte byte[] btye[][]
short short[] short[][]
float float[] float[][]
Date Date[] Date[][]

43
Build Strategies Chapter 14

Long
Decimal

Remark: We cannot see how Long[], Long[][], Decimal[], Decimal[][] types can be mapped
to VB.

14.2.4 Automate as much as possible


With the Component Packages and distribution media there is replication of information.
Moreover, the technology Aspects (tool integration, multi-platform support) of the core
business intelligence will be replicated across many instances. Therefore, by scripting
the repackaging and distribution of information, and scripting the wrapping of the core
algorithms with various technology aspects move the entire process efficient to a higher
order to magnitude.

44
Chapter 15

Multi-platform Build System Aspects

Though the build system itself consists of 10,000s of lines of intricate code, the application
of the build system significantly increases the efficiency with which a Component Based
Development process can be adopted within an organization.

Below I list three key ideas within the over-all design of our build system. By applying
these three principles through the build system you are able to gain from re-use of doc-
umentation and code throughout the multi-platforms software packages and Component
archive.

15.1 Items of Slide


• Super Documentation: Clean separation of documentation associated with Busi-
ness Intelligence and Technology Aspects.

• QA Clients: Multi-platform client generator from a single mark-up file.

• Code Aspect Wrappers: Clean separation of Business Intelligence implementation


and technology aspects within source code.

45
Chapter 16

Notion of ‘Super Docs’

The ’Super Docs’ are just a mark-up of the API documentation which is not specific to
any Component platform. The Super Docs are also the location where additional ’tags’
(or meta date) can be included:

16.1 Items of Slide


• SumStateless Super Docs - Mapped to JavaDocs, .NET API, COM/Delphi API,
.NET Web service API, EJB API, JSP/ASP.NET Clients.

• SumStateful Super Docs - Mapped to JavaDocs, .NET API, COM/Delphi API, .NET
Web service API, EJB API, JSP/ASP.NET Clients.

16.2 Description of Items


16.2.1 Super Documentation
This Super Docs refers to Java interfaces for which there is one interface for every business
class of the Component Package. Inside these interfaces, you will mention only public
methods implemented, specifying their return type, their name, their parameters and the
Java exceptions they throw.

Yet, because there is only one interface for every business class1 , this interface is used
to generate the API Reference for both Java, .NET and all other platforms. This basically
means that the JavaDocs method and constructor comments should focus as much as pos-
sible on the business functionality and leave out technical details.

For example, when referring to a business class, you will not say ‘class”, or ‘bean”, but use
the ‘:service:” tag which will be accordingly replaced by the .NET and Java scripts.
1
There are two interfaces for Stateful Business Classes: one for methods and another one for construc-
tors.

46
Notion of ‘Super Docs’ Chapter 16

16.2.2 SumStateless.java Super Docs


package WebCab.Cbd.BusinessLogic;

/**
* Stateless :service: which offers functionality for adding two real numbers.
*
* @excelClassName Sum
* @excelDescription Functionality for adding two real numbers.
*/
public interface SumStateless{

/**
* Evaluates the sum of two real numbers.
*
* @param a a double which is the first element of the sum.
* @param b a double which is the second element of the sum.
*
* @return the sum of two real numbers.
*/
public double sum(double a, double b);

16.2.3 SumStateful
package WebCab.Cbd.BusinessLogic;

/**
* Stateful :service: which offers functionality for adding two real numbers.
*
*/
public interface SumStateful{

/**
* Sets the value of the private field A, which holds a double.
*
* @param a is the first argument of the sum.
*/
void setA(double a);

/**
* Sets the value of the private field B, which holds a double.

47
Notion of ‘Super Docs’ Chapter 16

* arithmetic operation.
*
* @param b is the second argument of the sum.
*/
void setB(double b);

/**
* Returns the sum of the two private field A and B, which have been set using
* {@link #setA setA} and {@link #setA setA}.
*
* @return A double representing the sum of the two numbers.
*
* @throws Exception if one of the number had not been set.
*/
public double getSum() throws Exception;
}

48
Chapter 17

Multi Platform QA Client System

17.1 Items of Slide


• SumStatefulClient.xml - Mapped to C/VB.NET/C++.NET, Java, EJB, Delphi for
COM, Delphi for .NET,... via XSLT.

• SumStatelessClient.xml - Mapped to C/VB.NET/C++.NET, Java, EJB, Delphi for


COM, Delphi for .NET,... via XSLT.

17.2 Description of Items


17.2.1 ‘XML’ Mark-up of SumStateless Client
<overview>Client example of SumStateless Component.</overview>

<example name="Sum Two Real Numbers">


<call id="sum1" comment="Sum two numbers.">sum(20, 40)</call>
<question>Calculates the sum of 20 and 40.</question>
<answer>The sum of the two numbers is: </answer>
</example>

17.2.2 SumStatefulClient.xml
<overview>Client example of (stateful) SumStateful Component.</overview>

<example name="Set A coefficient">


<call id="setA" comment="Here we set A coefficient.">setA(46)</call>
<question>Here we set A coefficient.</question>
<answer>The first parameter has been set to 46.</answer>
</example>

49
Multi Platform QA Client System Chapter 17

<example name="Set B coefficient">


<call id="setB" comment="Here we set B coefficient.">setB(26)</call>
<question>Here we set B coefficient.</question>
<answer>The second parameter has been set to 26.</answer>
</example>

<example name="Sum of the coefficients">


<call id="sum1" comment="Here we evaluate the sum.">getSum()</call>
<question>Calculate the summ between 46 and 26.</question>
<answer>The sum is.</answer>
</example>

50
Chapter 18

Code Wrappers and Generated


Aspects

18.1 Items of Slide


• .NET Interop: Generation of COM Wrappers to expose .NET API to COM clients
platforms (Excel, Delphi, COM)

• JDBC/ADO Mediator: Clean Separation of the database connectivity.

• Platform Packaging: .NET XML Web services for IIS, EARs for J2EE App
Servers, WARs for Tomcat.

51
Chapter 19

.NET Package Structure

Here we details the packages structure of the CBD Example package for the .NET Plat-
form. The full CBD Example Package can be downloaed in source code and binary form
from the locations:

Binary Files Download


http://www.webcabcomponents.com/iom/development/examples/CBD dotNETFinal.zip
Source Code of the Generated Implementation Files
http://www.webcabcomponents.com/iom/development/examples/CBD dotNETSource.zip

19.1 Items of Slide


• \COM Libraries - COM DLL with type library file, HTML and CHM API docu-
mentation.

• \Documentation - PDF Documentation.

• \NET Libraries - .NET Component, QA Clients in C#/VB.NET/C++.NET,


ASP.NET Application, HTML and CHM API Documentation.

• \XML Web services - .NET Web service DLL with ASMX proxies, QA Clients in
C#/VB.NET, HTML and CHM API Documentation.

52
Chapter 20

J2SE Package Structure

Here we details the packages structure of the CBD Example package for the J2SE Plat-
form. The full CBD Example Package can be downloaed in source code and binary form
from the locations:

Binary Files Download


http://www.webcabcomponents.com/iom/development/examples/CBD JavaSource.zip

Source Code of the Generated Implementation Files


http://www.webcabcomponents.com/iom/development/examples/CBD JavaFinal.zip

20.1 Items of Slide


• Client\QAClients - QA Clients of Java.

• Deployment\ - Java JAR File and JSP WAR File.

• Documentaion\ - PDF Documentation.

• JavaDocs\ - JavaDocs API Documentation.

53
Chapter 21

Build System Input Files

Here for convenience we summaries the source files which are required by our build system
in order to create our CBD Build System example. So far only one of these types of files
namely the source code implementation files which we have not provided an example for
which we now provide below.

21.1 Items of Slide


• Super Docs - Non-Platform specific description of the API.

• Implementation Files - Pain POJO type Java and C# source code.

• QA Clients XML Markup - XML file describing the structure of the clients.

• PDF Super Docs - Describing Business Aspects of the Component used in PDF/Web
site.

21.2 Download Location of CBD Example Source Files


All the source files used within the build system for the generation of the CBD Component
Package example can be downlaoded from:

http://www.webcabcomponents.com/iom/development/examples/CBD BuildSources.zip

21.3 Description of Items


21.3.1 C# Source Code File of SumStateless
namespace WebCab.Libraries.Cbd.BusinessLogic {

public class SumStateless{

54
Build System Input Files Chapter 21

public SumStateless() {
}

public virtual double sum(double a, double b) {


return a+b;
}
}
}

21.3.2 C# Source Code File of SumStateful


namespace WebCab.Libraries.Cbd.BusinessLogic {

using System;

public class SumStateful{

public SumStateful() {
}

private double a, b;
private bool beenSetA = false, beenSetB = false;

public void setA(double a) {


this.a = a;
beenSetA = true;
}

public void setB(double b) {


this.b = b;
beenSetB = true;
}

public virtual double getSum(){


if (beenSetA == false)
throw new Exception("The parameter a has not been set.");
if (beenSetB == false)
throw new Exception("The parameter b has not been set.");

return this.a+this.b;
}
}
}

55
Build System Input Files Chapter 21

21.3.3 C# Source Code File of SumWithHelperType


namespace WebCab.Libraries.Cbd.BusienssLogicHelper
{

public class SumWithHelperType{

public SumWithHelperType() {
}

/*
* Function stuff.
*/
private Function f = null;

public void setFunction(System.Object o) {


this.f = retrieveDeliveryAsFunction(o);
}

private Function retrieveDeliveryAsFunction(System.Object delivery) {


return (Function)delivery;
}

public virtual double getValueAt(double a, double b) {


return f.getValueAt(a, b);
}
}
}

CSource Code File of Function Interface


namespace WebCab.Libraries.Cbd.BusinessLogicHelper
{
public interface Function {

double getValueAt (double a, double b);


}
}

PDF Super Documentation File used in PDF and Web site


Product Description
\section {Product Description}
\subsection {Overview}
{\sf Provides three implementation of a function which finds the sum of two real numbe

56
Build System Input Files Chapter 21

\subsection {Details}
Within this :product: we have implemented the following functionality:
\begin{itemize}
\item {\bf CBD Module}
\begin{itemize}
\item {\bf Sum} - The arithemtic sum of two real numbers.
\end{itemize}
\end{itemize}
\input{FromTemplate/features.tex}
\input{FromTemplate/packagedetails.tex}

57

Вам также может понравиться