software architecture vo/ku (707.023/707.024) denis...
TRANSCRIPT
Implementation ArchitectureSoftware Architecture VO/KU (707.023/707.024)
Denis Helic
KMI, TU Graz
Nov 7, 2012
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 1 / 41
Outline
1 Definition
2 Design
3 Behavior
4 Quality attributes
5 Prototype
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 2 / 41
Definition
Implementation Architecture
Focuses on how the system is built
Which technological elements are needed to implement the system
Software packages, libraries, frameworks, classes, ...
Addresses non-runtime quality attributes: configurability, testability,reusability, ...
Comprised of components and connectors
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 3 / 41
Definition
Implementation Architecture
Components and connectors reflect software entities and theirrelationships at the level of source and binary code
Typically a number of implementation models
Each model focuses on one of the concurrent subsystems or processesfrom the execution view
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 4 / 41
Definition
Components
Two types of components: application and infrastructure components
Application components are responsible for implementingdomain-level responsibilities
These are responsibilities found in a detailed conceptual architecture
Application components might be realized as binary packages, sourcepackages, and files
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 5 / 41
Definition
Components
Infrastructure components are needed to make the system run but arenot related to the application functionality
E.g. HTTP Connection Handler in our sample is a typicalinfrastructure component
Whether a particular component is an application or an infrastructurecomponent depends on the application
E.g. if we are building a Web application server then HTTPConnection Handler is an application component
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 6 / 41
Definition
Components
Often an infrastructure component acts as a “container” forapplication components
A container component provides an execution environment for thecontained components
Typically, the container executes within a process and creates threadsfor application components
E.g. a Web application server which runs multiple applications, eachof them in their own threads
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 7 / 41
Definition
Component stereotypes
Figure: Implementation stereotypes from Software Architecture Primer
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 8 / 41
Definition
Connectors
In implementation architecture connectors represent a “uses” relation
The arrow depicts the direction of this relation
The nature of communication is depicted through the connector styles
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 9 / 41
Definition
Connectors
API call: A component calls a method in another component(possibly only if both components are in the same process)
Callback: The caller passes a reference of an object to the callee. Thecallee invokes a method on that object later.
Network protocol: Needed when implementation components reside indifferent processes on networked machines. Components need toagree on a common protocol or use a standardized protocol
OS signals: Communication between processes running on the samemachine
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 10 / 41
Definition
Connectors
Figure: Implementation connectors from Software Architecture Primer
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 11 / 41
Definition
Connectors
In some cases we depict ports as endpoints of connectors betweencomponents
Ports are used to identify a particular component interface
E.g. a component might be quite complex but it provides a simpleinterface for communication
E.g. the standard Java library provides an API
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 12 / 41
Definition
Example
Figure: Example of implementation architecture from Software ArchitecturePrimer
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 13 / 41
Definition
Conceptual vs. Implementation
Element Conceptual Implementation
Components Domain-level responsibilities Implementation module
Connectors Information flow “Uses” relationship
Views Single Split
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 14 / 41
Definition
Conceptual vs. Execution vs. Implementation
Figure: Conceptual vs. execution vs. implementation from Software ArchitecturePrimer
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 15 / 41
Design
Implementation architecture design
1 Find application components
2 Find infrastructure components
3 Interface design
4 Behavior design and verification
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 16 / 41
Design
Application components
Ideal 1-to-1 mapping of conceptual components onto applicationcomponents is typically not possible
Some conceptual components will become infrastructure components
E.g. persistent storage (databases) are typically infrastructurecomponents
Some conceptual components are spread over a number of applicationcomponents
E.g. conceptual components have complex responsibilities
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 17 / 41
Design
Application components
A number of conceptual components can be mapped onto a singleapplication component
E.g. small number and simple responsibilities
Complex conceptual components might map on additional applicationcompinents
UI components map onto one application component (i.e. HTML UI)
All other map onto a single application component on the server
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 18 / 41
Design
Infrastructure components
Off-the-shelf components
Frameworks (e.g. application framework)
Servers (web, application, database, file)
Generic clients (browser)
In our sample at least two infrastructure components: browser,application server
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 19 / 41
Design
Sample infrastructure components
Web browser
Web application server
Apache Tomcat: http://tomcat.apache.org/
Reference implementation of the Servlet API
Servlet API abstracts the HTTP protocol from programmers andallows to write Java classes that handle HTTP requests
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 20 / 41
Design
Sample infrastructure components
public class SomeServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
...
PrintWriter out = response.getWriter();
...
}
}
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 21 / 41
Design
Sample infrastructure components
With a servlet we can read parameters from the user
E.g. dataset name, dataset file
We can respond with HTML
E.g a new input form for uploading a dataset
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 22 / 41
Design
Sample infrastructure components
Servlets are still very low level
We want to operate on a higher level of abstraction thanreading/handling user parameters
There are frameworks which abstract e.g. HTTP request/responsecycle
For example, for general UI applications MVC frameworks
Component-based frameworks such as GWT
Also, Java servlets are just one possibility (Python, PHP, etc..)
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 23 / 41
Design
Infrastructure selection
Research
Conceptual issues, e.g. MVC, component-based, service-based, ...
Execution issues, e.g. spawning of external processes
Implementation issues, e.g. programming language
Contextual issues, e.g. commercial products, open source, etc.
Organizational issues, e.g. know-how, team, ...
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 24 / 41
Design
Infrastructure selection
Trough research you will obtain a list of several infrastructures
Identification of criteria set (what is important)
Weighting of criteria (to what extent is some feature important)
Evaluation of modules
Selection
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 25 / 41
Design
Weighted Scoring Method
There are n alternatives A1,A2, ...,An
There are m different criteria C1,C2, ...,Cm
Each alternative is for each criterion with score Sij
Each criterion has a weight relative to its importance W1,W2, ...,Wm
The final score for the alternative Ai :
S(Ai ) =m∑j=1
SijWj (1)
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 26 / 41
Design
Weighted Scoring Method
For uniform distribution of weights:
S(Ai ) =1
m
m∑j=1
Sij (2)
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 27 / 41
Design
Weighted Scoring Method78 10. Solution Evaluation and Selection
Criteria group Criterion CodeFunctionality Login and access system1 F0Functionality Access rights and permission management1 F1Functionality Content management system1 F2Functionality ’Product basket’ feature1 F3Functionality Product catalogue management1 F4Functionality Product comparison feature1 F5Functionality Product management1 F6Functionality Product tagging feature1 F7Functionality Search feature1 F8Functionality Reporting feature1 F9Quality Adaptability/Source code quality1 Q0Quality Reliability1 Q1Quality Security1 Q2Quality Technology/Programming language1 Q3Usability Error reporting1 U0Usability User interface/Ease of use1 U1Vendor References2 V0Cost Installation and implementation cost1 C0
Table 10.3: Final evaluation criteria set.1 Very poor, poor, fair, good, very good - corresponding to numericalvalues 1 to 5.
2 Very poor (<3), poor (4-10), fair (11-20), good (21-30), very good(>30) - corresponding to numerical values 1 to 5.
problem because the complexity of the decision, that is the number of criteria and options, israther low.
10.4 Weighted Scoring Method (WSM)
In the first step each software package needs to be numerically evaluated for each criterion. Todo so the software is installed, executed, tested and its source code analysed. The results of thedetailed analysis of each software package for each criterion can be found in the appendix insection A.1, in table A.1 for Magento, in table A.2 for OSCommerce, in table A.3 for Zen Cartand in table A.4 for PHPB2B. The detailed analysis justifies the score for each package andeach criterion.
Secondly, the individual weighting for each criterion needs to be determined in order to calculatethe weighted sum, which is the score for each package. In the simplest approach each criterionhas the same weighting (i.e. averaging criteria scores). With more sophistication the weightingis adapted to the specific needs of this project in correspondence with the weighted scoringmethod.
Table 10.4 summarises the results for the WSM evaluation. Column two represents the simpleaverage weightings, column three the more sophisticated relative weightings tailored to this pro-ject and column 4 normalises them to serve as basis for the weighted scoring method. Columns
Figure: Example of WSMDenis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 28 / 41
Design
Weighted Scoring Method
80 10. Solution Evaluation and Selection
Criteria Weighting SW Package ScoreCode AVG1 RW2 WSM3 Magento OSCommerce Zen Cart PHPB2BF0 6% 3 8% 5 3 2 5F1 6% 3 8% 2 1 1 5F2 6% 1 3% 5 1 1 3F3 6% 1 3% 4 3 3 4F4 6% 3 8% 4 3 3 5F5 6% 1 3% 5 1 1 1F6 6% 3 8% 5 3 3 3F7 6% 1 3% 5 1 1 1F8 6% 2 5% 4 4 4 4F9 6% 1 3% 4 3 3 3Q0 6% 5 13% 5 3 3 1Q1 6% 2 5% 5 5 5 1Q2 6% 1 3% 5 5 5 2Q3 6% 4 10% 5 3 3 1U0 6% 1 3% 4 3 3 2U1 6% 2 5% 5 5 5 2V0 6% 1 3% 5 5 4 3C0 6% 5 13% 3 3 3 2
AVG Score 4,44 3,06 2,94 2,67Norm. AVG Score 34% 23% 22% 20%
WSM 4,33 3,05 2,95 2,65Norm. WSM 33% 24% 23% 20%
Table 10.4: Scores of software packages based on WSM.1 Simple average weighting (AVG) for all criteria.2 Relative weighting (RW) for each criterion with 1 to 5, low to high importance.3 Normalised weights derived from RW for the weighted scoring method (WSM).
The WSM’s clear winner is Magento, whereas OSCommerce and Zen Cart have not onlyvery similar overall score but also similar scores for each criterion. The reason is that ZenCart is based on OSCommerce and has thus very similar properties and functionalities.One at first rather surprising finding is the fact that differences between the score based onaverage weights and the WSM weights are almost negligible. Since the distribution betweenthe scores for each criterion and the distribution between the relative weightings is rathersmall (1-5), with the number of criteria high (18), small changes in the weighting of thecriteria do not have a significant effect on the total score.Figure 10.1 illustrates the normalised and weighted scores for each criterion and softwarepackage. Criteria Q0 (adaptability/source code quality) and C0 (installation and imple-menation cost) with a weighting of 12,5%, together with Q3 (technology/programminglanguage) at 10% were rated as most important criteria. Magento scored at the top forall criteria, except for F1 where it was strongly outperformed by PHPB2B. Overall all thefigure shows clearly why Magento is to be chosen.
Figure: Example of WSMDenis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 29 / 41
Design
Sample infrastructure selection
Apply the same methodology for your projects
We select Open Source Java with Tomcat
We select component-based framework
Apache Wicket as a Web application framework
We select SNAP library for network analysis
We select gnuplot for diagrams
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 30 / 41
Design
Interface design
For all application and infrastructure components we need to defineinterfaces (ports)
Helps in clarifying the responsibilities of a component
Some interfaces are also standardized
E.g. HTTP, SQL, File I/O
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 31 / 41
Design
Sample interface design
UI: Combination of HTML/HTTP
It is standardized!
Web application server: HTTP/Servlet API
It is standardized
Component separation
Wicket components are specified by the framework
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 32 / 41
Design
Sample interface design
We need to specify interface between Wicket and our application logic
A new interface is needed
We need to tell to the application logic that there is a request for ane.g. calculation
e.g. executeCalculation(user, dataset)
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 33 / 41
Design
Sample interface design
We should also tell to the system where to write calculations,datasets, users, etc.
Typically these are only files
We can store users in an e.g. XML file
e.g. users.storeUser(user);
calcs.storeCalc(calc);
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 34 / 41
Behavior
Behavior design
Now we need to go into details
Use-case maps are not enough anymore
We need to investigate behavior at the operation level
Thus, we need a sequence diagram
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 35 / 41
Behavior
Sample implementation Architecture
Figure: Detailed sample implementation architecture
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 36 / 41
Behavior
Sample implementation Architecture
Figure: Sample implementation architecture
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 37 / 41
Behavior
Sample interface Sequence Diagram
Figure: Sample sequence diagram
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 38 / 41
Quality attributes
Non-runtime quality attributes
Since implementation view addresses build structure
It is the right place to consider non-runtime quality attributes
E.g. maintainability, extensibility, reusability, ...
We can use a mechanism similar to use-case maps
Impact-maps: try to investigate what parts of the system need tochange if “something” happens
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 39 / 41
Quality attributes
Impact-maps
Map 1: new external system - interface to external system needs tobe changed
Map 2: new calculation - network analysis application componentneeds to be changed
Map 3: new UI - UI component needs to be changed
Goal: as few component changes as possible
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 40 / 41
Prototype
Prototype
To show that the architectural solution is feasible we implementprototypes
For each identified application component we provide implementation
Deploy it within the infrastructure components
Test it and check correctness, functionality, quality-attributes
Denis Helic (KMI, TU Graz) Implementation Architecture Nov 7, 2012 41 / 41