Home Page   We Generate Your Software.
Products Services Company Technology Demo Contact Site Map Search
The Somusar/SoProTech[tm] Booklet Series
Volume II

"somusar/SoProTech: A Sample Project"

Printer friendly


Contents
1. Introduction
2. Sample Project Entities
3. Sample Project Mold Kit
4. Project Conventions
5. Exercise 1: Adding Field currency to Entity country
6. Exercise 2: Adding Entity "company.ef"
6.1 Request For Change
6.2 Change Impact Analysis
6.3 Change Implementation
6.4 Actual Change Impact
7. Exercise 3: Changing all SQL Scripts and all HTML Forms
8. Further Reading
Appendix A - Project Entity Files
Appendix B - Library Entities

Chapter 6 - Exercise 2: Adding Entity "company.ef"

In the second exercise a new entity is added to the sample software system, showing how SoProTech[tm] can support incremental growth of medium and large software systems over time.

6.1 - Request For Change        top

The careful reader may have noticed that a key entity is missing in the sample project: no entity company has been defined. In fact, after an early design review, the sample project team decides to add entity company, which logically belongs to project directory "project/company", as shown in the reviewed entity-relationships diagram.

Figure 6 - Modified entity/relationships diagram
Figure 6 - Modified entity/relationships diagram
Enlarge

6.2 - Change Impact Analysis        top

The DB expert of the team suggests that an SQL company table is definitely necessary, and that it should contain the following columns:

  • The company name, which should also act as primary key;

  • A column relating to the departments of the company;

  • The address of the company headquarters;

  • A description of the company business.

Beyond those fields, the object-oriented expert suggests that the Java[tm] and C++ classes would benefit of lists of the company's employees, customers, and projects.

6.3 - Change Implementation        top

A first version of "company/company.ef" is quickly ready, and a few tries at generating the HTML full_view form convince the UI expert to suggest a change in the project conventions, as the full_view of the company has too many lists, that make it too big to fit on the screen.

Therefore a new adjusting parameter for the UI facet is added to the project conventions, and two scripts of mold "UI/mold2-.fview" are accordingly extended.

The final version of "entity.ef" is thus ready, and - due to the new project convention - a complete re-generation of all software files, and a comparison with the previous version of generated files are deemed advisable. So the SoProMach[tm] is started.

6.4 - Actual Change Impact        top

After seven seconds all newly generated files - a little more than one hundred files - can be compared with their former counterparts, and the comparison ensures that no undesired changes have taken place. Depending on their system layer expertise, the project team members check that the files generated for the new entity company are correct, and integrate them within the rest of the project.

The next code example describes the new entity. The most relevant generated files are listed, or shown, in the following code examples and illustrations.

Code Example 6 - New entity "company.ef"
The new entity is similar to the other ones, except for several adjusting parameters for its UI.full_view (lines 32-37). In particular, a new adjusting parameter make_button is used on lines 35-37 for three lists within the full_view.
Source code - File "company/company.ef"
    1      company "Company"
    2      | A commercial company, its address, personnel, customers and activities
    3      
    4      strings.name            company_name    "Company name"
    5      strings.description     business        "Business description"
    6      address                 headquarters    "Headquarters address"
    7      list employee           employees       "Employees"
    8      list department         departments     "Departments"
    9      list customer           customers       "Customers"
   10      list project            projects        "Projects"
   11      
   12      ------------------------- DEFS
   13      ------------------------- DB
   14      table:
   15      company_name, departments, headquarters, business
   16      
   17      pkey:
   18      company_name
   19      ------------------------- LOGIC
   20      class:
   21      company_name, business, headquarters, employees, departments, customers, projects
   22      ------------------------- UI
   23      full_view:
   24      company_name...........
   25      business.customers.....
   26      .........employees.....
   27      .........projects......
   28      .........departments...
   29      headquarters...........
   30      ------------------------- ADJUST
   31      DB.table.create = "true"
   32      UI.full_view.company_name.colspan = "3"
   33      UI.full_view.business.rowspan = "4"
   34      UI.full_view.headquarters.colspan = "3"
   35      UI.full_view.employees.make_button = "true"
   36      UI.full_view.departments.make_button = "true"
   37      UI.full_view.projects.make_button = "true"
	       

Figure 7 - From UI.full_view to "company.html"
Figure 7 - From <tt>UI.full_view</tt> to <tt>"company.html"</tt>
Enlarge

Code Example 7 - From DB.table and DB.pkey to "company.sql"
The SQL script to create the company table fully complies with the project conventions.
Source code - File "company/DB/company.sql"
    1      --
    2      -- This SQL script created by somusar/SoProMach[tm]
    3      --
    4      
    5      create table company (
    6          companyname               varchar(40)    not null,
    7          departmentsdeptid         varchar(10)    not null,
    8          headquartersstreet        varchar(80)    not null,
    9          headquarterscity          varchar(80)    not null,
   10          headquartersstate         varchar(40)        null,
   11          headquarterszip           varchar(20)    not null,
   12          headquarterscountryname   varchar(40)    not null,
   13          headquarterswebsite       varchar(80)        null,
   14          business                  varchar(200)   not null,
   15          constraint pk_company     primary key    (companyname)
   16      )
   17      ;
   18      
	       

Code Example 8 - From LOGIC.class to "Company.java"
This Java class source file fully complies with the project conventions.
Source code - File "company/LOGIC/Company.java"
    1      /*
    2       * This Java class generated by somusar/SoProMach[tm].
    3       */
    4      
    5      package com.somusar.entdemo.company;
    6      
    7      /**
    8       *   Class Company:
    9       *
   10       *   A commercial company, its address, personnel, 
   11       *   customers and activities.
   12       */
   13      
   14      import com.somusar.entdemo.location.Address;
   15      import com.somusar.entdemo.company.Employee;
   16      import java.util.Collection;
   17      import com.somusar.entdemo.company.Department;
   18      import com.somusar.entdemo.business.Customer;
   19      import com.somusar.entdemo.business.Project;
   20      
   21      public class Company {
   22      
   23          private String       companyName;        
   24          private String       business;           
   25          private Address      headquarters;       
   26          private Collection   employees;          
   27          private Collection   departments;        
   28          private Collection   customers;          
   29          private Collection   projects;           
   30          
   31          /*
   32           *   Get methods
   33           */
   34      
   35          public String getCompanyName() {
   36              return companyName;
   37          }
   38      
   39          public String getBusiness() {
   40              return business;
   41          }
   42      
   43          public Address getHeadquarters() {
   44              return headquarters;
   45          }
   46      
   47          public Collection getEmployees() {
   48              return employees;
   49          }
   50      
   51          public Collection getDepartments() {
   52              return departments;
   53          }
   54      
   55          public Collection getCustomers() {
   56              return customers;
   57          }
   58      
   59          public Collection getProjects() {
   60              return projects;
   61          }
   62      
   63          /*
   64           *   Set methods
   65           */
   66      
   67          public void setCompanyName( String companyName ) {
   68              this.companyName = companyName;
   69          }
   70      
   71          public void setBusiness( String business ) {
   72              this.business = business;
   73          }
   74      
   75          public void setHeadquarters( Address headquarters ) {
   76              this.headquarters = headquarters;
   77          }
   78      
   79          public void setEmployees( Collection employees ) {
   80              this.employees = employees;
   81          }
   82      
   83          public void setDepartments( Collection departments ) {
   84              this.departments = departments;
   85          }
   86      
   87          public void setCustomers( Collection customers ) {
   88              this.customers = customers;
   89          }
   90      
   91          public void setProjects( Collection projects ) {
   92              this.projects = projects;
   93          }
   94      
   95      }
	       

Figure 8 - Documentation generated for company
Figure 8 - Documentation generated for <tt>company</tt>
Enlarge

[Previous chapter]    [Next chapter]    [Back to top]

http:// www.somusar.com  / doc  / booklets  / sample_proj  - Powered by SoProMach
Copyright © 2003-2012 Somusar - Trademarks - Legal - Privacy - Webmaster