01-Implementation Procedure

Purpose

The objective of the implementation procedure is the transformation of the detailed design representation into a programming language realization by applying the appropriate coding standard and to develop the required product documentation to support the coded product. The code will be grouped into executable units (this will be dictated by the selected language and design information). All units shall be transformed into executable code to be debugged. Incorrect code and other product component will be re-worked until run free of errors.

Inputs

No

Input

Coming from/Output Of

1.       

EA File

Updated analysis, Architecture and design models

Activities

No

Activity

RESP

Input

Output

Temp/Solution

1.       

Review Interface Descriptions of the components integration and notify related stakeholders for changes

Scrum Master, DEV Team

All _Procedure Inputs

Product source code

EA Repo

2.       

Review the release completeness by verifying the UC & UX and solution mapping

SM, PO

All _Procedure Inputs

Product source code

Language related component

3.       

Understand software specs (Use cases and activity diagrams) to implement the solution.

Scrum Master, DEV Team

All _Procedure Inputs

Product source code

EA Repo

4.       

Generate physical Components using the created component diagram.

Scrum Master, DEV Team

All _Procedure Inputs

Product source code

Language related component

5.       

Create implementation components, classes using the output of use cases (and/Or) class diagram

Scrum Master, DEV Team

All _Procedure Inputs

Product source code

Implementation classes

6.       

Translate the use case details in the implementation classes as follow:

1-Pre-conditions:

Can be done throw: if statements in the caller class or in the main use case main function.

Or Check_Before_+’UC’ function.

2-Scenario: Main function

3-Alternative Scenario:

‘UC’+Alternative Name,

5-Exception: Handling Exception behavior

Scrum Master, DEV Team

All _Procedure Inputs

Product source code

Implementation classes

7.       

Create and debug components codes, and interfaces code according to procedure inputs and coding standard using the detailed design documents and diagrams.

Scrum Master, DEV Team

All _Procedure Inputs

Product source code

Models

8.       

Create and test database according to procedure inputs and normalization techniques.

Scrum Master, DEV Team

All _Procedure Inputs

Executable Product Components

 

9.       

Ensure that all product components are compatible and ready for integration considering component reusability  including code units, database, DLL etc.

Scrum Master, DEV Team

Executable Product Components

Ready Executable Product Components

UI and design models

10.    

Perform initial integration of all product components.

Scrum Master, DEV Team

Executable Product Components

Initial Integrated Product

 

11.    

Call Refactoring process to enhance source code quality and maintainability.

Scrum Master, DEV Team

Source code

Source Code

Source Code

12.    

Add source code documentation:

-Class objectives

-operation objectives

-operation inputs and outputs description

-scenario description: each bulk of code

-line comment

Scrum Master, DEV Team

Source code

Commented source code

 

13.    

Generate Release notes for work performed

Scrum Master, DEV Team

Executable Product Components

Initial Integrated Product

TFS/DevOps Notes query

14.    

Add/Update Code Metrics and resolve required issues

Scrum Master, DEV Team

Executable Product Components

 

TFS/DevOps Notes query

15.    

Add/Update performance metrics and resolve required issues

Scrum Master, DEV Team

Executable Product Components

 

TFS/DevOps Notes query

16.    

Analyze code metrics as follow:

·        Do we have the suitable LOC for module

·        Do we have the suitable metrics changes according to work performed

·        How to increase maintainability

·        How to decrease : LOC, coupling, cyclomatic index

 

Note: Use in order to enhance code metrics, use the following:

  • PD_Code_Refactoring_Procedure.htm
  • PD_DB_Refactoring_Procedure.htm
  • Audit_CheckLists.htm

Scrum Master, DEV Team

Executable Product Components

 

TFS/DevOps Notes query

Outputs

No

Output

Going To/Input Of

1.       

Approved Product Components

PD_Unit_Test_Execution_Procedure

2.       

Updated EA File

 

 

 


 

02-DB Refactoring Procedure

Purpose

The objective of this procedure is to evaluate, and enhance current software code process according to a predefined standards focusing on the business needs and highly bad analysis metrics.

Refactoring means enhancing the solution architecture after we develop the solution to consider quality factors like maintainability, scalability, performance, reusability and all other attributes.

When it takes time to create nothing, then you need to refactor.

We need to build a code not only for machine to understand, but also for human to understand.

We need it: easy to understand, cheaper to maintain, easy to find bugs, increase performance.

 

Refactoring should be done when:

1.      Creating new function

2.      Solving bugs

3.      Code Review

 

SQL Server Refactoring methods

  1. Structural – A change in the definition of tables, views, and columns. Some of these refactoring’s include the replace one- to- many relationship with associative table, split table, rename table, and more
  2. Data Quality – This category of refactoring is covers changes that improve the quality of the data stored in a database. Refactoring’s in this category are add lookup table, drop standard type, move data, and more
  3. Referential Integrity – Changes that ensures that any data that is referenced by one table exists, and also that unused data is removed
  4. Architectural – Changes with a goal of improving the overall methodology in which external applications interact with a database
  5. Method – Code changes like adding/removing parameters to a stored procedure, with a goal to improve overall quality
  6. Transformations – Changes in a database schema. For example introducing a new table or a column, and inserting and updating data
  7. Performance: Use one trip to the table for read or update instead of multiple visits.

 

Inputs

No

Input

Coming from/Output Of

1

Db Design

PD_Implementation

 


 

Refactoring Database Activities

No

Activity

Responsible

Input

Output

Temp/Solution

1.       

Review database tables for:

1.    remove all fields can be calculated using a clear criterion

2.    Remove fields without need or added values to the business model

3.    Add standard objects fields for tracability (Created by, creation date, modification date, modified by)

4.    Add standard objects fields (transactional, status) according to object nature

TL and DEV team

Database

Updated Database

SQL Database

2.       

Review database tables for:

1.    Remove

2.    Merge with the same key

3.    Merge with the same purpose

4.    Becoming logical view

 

 

 

 

3.       

Add check constraints to prevent data inconsistency

Ex:

ALTER TABLE dbo.Employee ADD CONSTRAINT

       CK_Employee_Gender CHECK (Gender IN ('M','F'))

 

TL and DEV team

Database

Updated Database

SQL Database

4.       

In order to prevent model customization for handling attributes default values, Give default value to any attributes according to the need

TL and DEV team

Database

Updated Database

SQL Database

5.       

Do not add grouping for columns without needs

For example :

Group by Code,Name0,Name1

TL and DEV team

Database

Updated Database

SQL Database

6.       

Index ordering and grouping columns in order to enhance performance.

TL and DEV team

Database

Updated Database

SQL Database

7.       

Do not repeat calls without needs, for example:

Select account.*, dbo.GetValue(“Order”) from account

 

Because repeated calls per each row will get the same value.

 

TL and DEV team

Database

Updated Database

SQL Database

8.       

Arrange your where condition column by putting what reduces the result-set significantly, then the remaining

 

 

 

 

9.       

Follow the fifth normalization forms for data models specially the MVD model.

MVD means multi value driven attributes, so if field is already generated by equation of other fields, it should not be recorded in the database.

Example : a = b* 4c

You should calculate a in one of:

1.    View

2.    Function

3.    Procedure

 

This feature should be applied if the value is not subject for adding new value or updating the calculated value.

For example:

Calculating Barcodes with facility to add new or update.

 

Example:

1.    Use calculated field

TL and DEV team

Database

Updated Database

SQL Database

10.    

Set the selection period to the last visited procedures related to the last year by the following query:

select *

  from Koudjis.information_schema.routines

 where routine_type = 'PROCEDURE'

   and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

   AND LAST_ALTERED >= ‘1/1/2014’

   ORDER BY LAST_ALTERED DESC

TL and DEV team

Database

Updated Database

SQL Database

11.    

Select the first procedure and open it for analysis

TL and DEV team

Database

Updated Database

SQL Database

12.    

Search for repeated groups to separate them in new function, using the routine definition column as follow:

select *    

  from Koudjis.information_schema.routines

 where routine_type = 'PROCEDURE'

   and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

   AND ROUTINE_DEFINITION LIKE '%, SPACE(1), SPACE(0))))) = SPACE(0)%'

   ORDER BY LAST_ALTERED DESC

TL and DEV team

Database

Updated Database

SQL Database

13.    

Search for repeated select statement to separate them in new function, using the routine definition column,like getting the default currency as follow:

select *

  from information_schema.routines

 where routine_type = 'PROCEDURE'

   and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

   AND ROUTINE_DEFINITION LIKE '% = CurrencyID%'

   ORDER BY LAST_ALTERED DESC

TL and DEV team

Database

Updated Database

SQL Database

14.    

In order to increase reusability and maintainability, Separate function steps in separate procedures using the following Name: Module name + ‘_’  +Function Name

TL and DEV team

Database

Updated Database

SQL Database

15.    

Create Temp table instead of physical tables for temp calculation using the following query:

Search for repeated select statement to separate them in new function, using the routine definition column,like getting the default currency as follow:

select *

  from information_schema.routines

 where routine_type = 'PROCEDURE'

   and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

   AND ROUTINE_DEFINITION LIKE '%create table%'

   ORDER BY LAST_ALTERED DESC

 

 

TL and DEV team

Database

Updated Database

SQL Database

16.    

Create function or procedure for all aggregate required functionalities, like sum and count with or without conditions using the following queries:

select *

  from information_schema.routines

 where routine_type = 'PROCEDURE'

   and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

   AND ROUTINE_DEFINITION LIKE '%select count%'

   ORDER BY LAST_ALTERED DESC

 

 

select *

  from Koudjis.information_schema.routines

 where routine_type = 'PROCEDURE'

   and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

   AND ROUTINE_DEFINITION LIKE '%select sum%'

   ORDER BY LAST_ALTERED DESC

 

TL and DEV team

Database

Updated Database

SQL Database

17.    

Remove any dependencies on the language [for main operation, not localization for the content] by separating strings in resource table.

Use the following query to detect them:

select *

  from information_schema.routines

 where routine_type = 'PROCEDURE'

   and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

   AND ROUTINE_DEFINITION LIKE '%CASE @lang%'

   ORDER BY LAST_ALTERED DESC

 

 

 

TL and DEV team

Database

Updated Database

SQL Database

18.    

Add Function for date conversion, and use it for all date fields as follow:

select *

  from information_schema.routines

 where routine_type = 'PROCEDURE'

   and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

   AND ROUTINE_DEFINITION LIKE '%Convert(datetime%'

   ORDER BY LAST_ALTERED DESC

TL and DEV team

Database

Updated Database

SQL Database

19.    

Merge duplicated procedures when they are resulted from the same query, for example:

select *

  from information_schema.routines

 where routine_type = 'PROCEDURE'

   and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

   AND (ROUTINE_DEFINITION LIKE '%select sum%' or ROUTINE_DEFINITION LIKE '%select count%')

   ORDER BY LAST_ALTERED DESC

 

 

You will find  that the result contains:

proc_CashBoxBalance

proc_BoxBalance

 

In addition, they have the same body.

TL and DEV team

Database

Updated Database

SQL Database

20.    

Create an Enum table and enum function in order to simplify the queries and increase reusability as follow:

 

create table  CustomLookups (id int, Name nvarchar(20),primary key (id,name))

 

 

insert into  CustomLookups (id,Name) values(0,'CashAdd')

insert into  CustomLookups (id,Name) values(1,'CashAdd')

insert into  CustomLookups (id,Name) values(2,'CashAdd')

select * from GetEnumValues('CashAdd');

 

 

insert into  CustomLookups (id,Name) values(10,'DRCR')

insert into  CustomLookups (id,Name) values(20,'DRCR')

select * from GetEnumValues('DRCR');

 

CREATE FUNCTION GetEnumValues(@EnumName nVarchar(20))

RETURNS @EnumItems TABLE (Id int NOT NULL)

AS

BEGIN

   INSERT INTO @EnumItems (Id)

   SELECT Id FROM   Enums

   WHERE  name = @EnumName;

   RETURN;

END;

 

 

For example the procedure proc_Stock_GetTransSearch, you should use it in the [where] conditions.

 

TL and DEV team

Database

Updated Database

SQL Database

21.    

Unify Search procedures by parameterize them by the table name:

select *

from Koudjis.information_schema.routines

where routine_type = 'PROCEDURE'

and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

AND Routine_Name like '%bylike'

ORDER BY LAST_ALTERED DESC

                                                 

TL and DEV team

Database

Updated Database

SQL Database

22.    

Move update or delete statements to new procedures using the following query:

select *

from Koudjis.information_schema.routines

where routine_type = 'PROCEDURE'

and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

AND (

ROUTINE_DEFINITION LIKE '%update %'

or

ROUTINE_DEFINITION LIKE '%delete from %'

or

ROUTINE_DEFINITION LIKE '%insert into %' 

or

ROUTINE_DEFINITION LIKE '%select into %'

)

ORDER BY LAST_ALTERED DESC

 

 

TL and DEV team

Database

Updated Database

SQL Database

23.    

Unify lists procedure to have a parameter for the table name and return all records of the table:

select *

from Koudjis.information_schema.routines

where routine_type = 'PROCEDURE'

and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

AND (

ROUTINE_NAME LIKE '%_GetAll'

)

ORDER BY LAST_ALTERED DESC

TL and DEV team

Database

Updated Database

SQL Database

24.    

Unify Delete procedure by parameters as follow:

 

select *

from Koudjis.information_schema.routines

where routine_type = 'PROCEDURE'

and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

AND (

ROUTINE_NAME LIKE '%_DeleteByPrimaryKey'

)

ORDER BY LAST_ALTERED DESC

 

TL and DEV team

Database

Updated Database

SQL Database

25.    

Unify Getting all records by primary key using the following:

 

select *

from Koudjis.information_schema.routines

where routine_type = 'PROCEDURE'

and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

AND (

ROUTINE_NAME LIKE '%_GetByPrimaryKey'

)

ORDER BY LAST_ALTERED DESC

 

 

TL and DEV team

Database

Updated Database

SQL Database

26.    

Find the data duplication using the following sql by replacing the table name:

declare @nTotalCount int;

declare @nDistCount int;

 

set @nDistCount = (select count(1) from (select distinct * from _Edarat) recset);

set @nTotalCount = (select count(1) from _Edarat)

select @nTotalCount -@nDistCount;

 

 

 

 

 

27.    

Consolidate the functions that retrieve specific values from an object, Like GetAreaCode,GetAreaName.

Create Tabular function GetAreaInfo to retrieve the mentioned columns and use the cross apply or outer apply to us it.

 

select * from stockdet

outer apply dbo.GetAccountInfo(0, AddAccount) AccountInfo

 

 

 

 

 

28.    

Review database objects sizes in order to decrease the database size, and enhance the performance, using the following statement:

select * from (SELECT 
    t.NAME AS TableName,
    s.Name AS SchemaName,
    p.rows AS RowCounts,
    SUM(a.total_pages) * 8 AS TotalSpaceKB, 
    CAST(ROUND(((SUM(a.total_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS TotalSpaceMB,
    SUM(a.used_pages) * 8 AS UsedSpaceKB, 
    CAST(ROUND(((SUM(a.used_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS UsedSpaceMB, 
    (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB,
    CAST(ROUND(((SUM(a.total_pages) - SUM(a.used_pages)) * 8) / 1024.00, 2) AS NUMERIC(36, 2)) AS UnusedSpaceMB
FROM 
    sys.tables t
INNER JOIN      
    sys.indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN 
    sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
INNER JOIN 
    sys.allocation_units a ON p.partition_id = a.container_id
LEFT OUTER JOIN 
    sys.schemas s ON t.schema_id = s.schema_id
WHERE 
    t.NAME NOT LIKE 'dt%' 
    AND t.is_ms_shipped = 0
    AND i.OBJECT_ID > 255 
GROUP BY 
    t.Name, s.Name, p.Rows
--ORDER BY     t.Name 
) recset

order by recset.usedspacemb desc

Find all tables without primary key in order to:

-        Check why they are without primary key

-        Remove duplicates from the table if exists

 

SELECT SCHEMA_NAME(schema_id) AS SchemaName,name AS TableName

FROM sys.tables

WHERE OBJECTPROPERTY(OBJECT_ID,'TableHasPrimaryKey') = 0

ORDER BY SchemaName, TableName;

 

 

 

 

 


 

 

Outputs

No

Output

Going To/Input Of

1

Approved Corrective Actions

Updated Source code

2

Updated Models

EA Models

 

 

 


 


 

03-Code Refactoring Procedure

Purpose

The objective of this procedure is to evaluate, and enhance current software code process according to a predefined standards focusing on the business needs and highly bad analysis metrics.

Refactoring means enhancing the solution architecture after we develop the solution to consider quality factors like maintainability, scalability, performance, reusability and all other attributes.

When it takes time to create nothing, then you need to refactor.

We need to build a code not only for machine to understand, but also for human to understand.

We need it: easy to understand, cheaper to maintain, easy to find bugs, increase performance.

 

Refactoring should be done when:

4.      Creating new:

a.      Components

b.      Classes

c.      Functions

5.      Solving bugs

6.      Code Review

 

Source code Refactoring methods

 

Extract

Move

Update/ Unify

Component

To keep reusability out of the current solution

-Use SRP

-Keep small paces

Class

-Extract super class: for shared functionality between classes

-Extract class: for repeated code between unrelated classes

-Lazy classes[1] to be merged with active one

-Use SRP

-Keep small paces

-Use inheritance

Operation

Keep functions reusable, maintainable, so decreasing the duplicate behavior

-Separate the code to the correct place in the source code

-Use SRP

-Keep small paces

-Change the operation signature

-Increase the values domain be sent to decrease the LOC and increase reusability

-remove non-valued parameters

Attribute

 

Put it in the correct location

Self-Encapsulate fields[2]

 

SQL Server Refactoring methods

8.     Structural – A change in the definition of tables, views, and columns. Some of these refactoring’s include the replace one- to- many relationship with associative table, split table, rename table, and more

9.     Data Quality – This category of refactoring is covers changes that improve the quality of the data stored in a database. Refactoring’s in this category are add lookup table, drop standard type, move data, and more

10.  Referential Integrity – Changes that ensures that any data that is referenced by one table exists, and also that unused data is removed

11.  Architectural – Changes with a goal of improving the overall methodology in which external applications interact with a database

12.  Method – Code changes like adding/removing parameters to a stored procedure, with a goal to improve overall quality

13.   Transformations – Changes in a database schema. For example, introducing a new table or a column, and inserting and updating data

14.   Performance: Use one trip to the table for read or update instead of multiple visits.

Steps

S#

Step

Definition

4.      

Code Cleaning

Includes:

·       Removing un-used classes, functions and variables.

·       Separating resources to resource dll

·       Merge UI events together like controls enter and set focus and lost focus

·       Move  all system parameters that be sent statically to resources

5.      

Code slicing

Includes:

·       Slicing class to set of classes.

·       Slicing class to set of functions.

·       Reuse separated classes and functions

 

6.      

Code Refactoring

Includes:

·       Redesign solution according to business functionality, so class should represent the required business model.

·       Evaluate the correct way of implementation and re-implement the correct one.

·       Create reusable components for objects

·       Build the solution according to MVC model to coupe with web model

                                               

7.      

Client Side refactoring

Includes:

1-     Refactoring HTML files

2-     Refactoring Javascript files

3-     Refactoring JQuery files

4-     Migration to TYPESCRIPT

 

Inputs

No

Input

Coming from/Output Of

1

Source Code

PD_Implementation

Refactoring Backend Activities

No

Activity

Responsible

Input

Output

Temp/Solution

1.       

Get the latest source code from configuration management environment for the selected project/component for refactoring.

TL and DEV team

TFS access

Free Errors code

VSS

2.       

Remove un-used namespaces, classes, and member functions

TL and DEV team

TFS access

Free Errors code

 

3.       

Separate resources to resource module

TL and DEV team

Source Code

Updated Source Code

 

4.       

Move all system parameters that be sent statically to resources, like:

String strName = GetModuleName(“ARM”);

TL and DEV team

 

 

 

5.       

Conduct code cleaning and merge process for same bulks using the analyze solution for code clones

TL and DEV team

TFS access

Free Errors code

VSS

6.       

Calculate and save code metrics for the selected project

TL and DEV team

Free Errors code

Code Metrics Resuilts

VS 2013

7.       

Remove all functions with zero lines of codes, using metrics

TL and DEV team

Free Errors code

Code Metrics Resuilts

VS 2013

8.       

Search For events handlers to find duplications and unify event handlers using if conditions for the command or control.

TL and DEV team

Free Errors code

Code Metrics Resuilts

VS 2013

9.       

Arrange the source code metrics priority according to the low maintainability, high cyclomatic, and high line numbers of code.

Arrange starts with:

1.      Red dots

2.      Triangles

3.      Minimum number of the maintainability index.

TL and DEV team

Code Metrics Resuilts

Priorities

 

VS 2013

10.    

Understand the selected function logically, from business and technical point of view

TL and DEV team

Free Errors code

Understanding

Source Code

11.    

Set Proposal for the class design from functionality perspective not UI perspective[3], according to its functionality using the following elements:

1.      UI

2.      Source code

TL and DEV team

Free Errors code

Understanding

Source Code

12.    

Remove all dependencies on the UI elements that direct the business, so do not check if field is visible or enabled, but use the main attribute or business rule that cause the change of appearance.

TL and DEV team

Free Errors code

Understanding

Source Code

13.    

Group each set of code according to its functionality, so slicing should be on business workflow; this will help you to let your code tell your business.

TL and DEV team

Source Code

Group of source code lines created

Updated Source code

14.    

Slice the function to a set of functions according to the grouped lines.

In case of Non-MVC code, use the following pattern:

-        Read from UI

-        Execute behavior

-        Update UI

 

TL and DEV team

Source Code

New Functions created

Updated Source code

15.    

Set the function signature according to:

1-      Functionality

2-      Expected inputs: that links the lines before the function with the function.

3-      Expected outputs: that needed to complete the execution after the function.

TL and DEV team

Source Code

New Functions created

Updated Source code

16.    

Find code similar groups and replace if typical, considering that maximum number of lines per function is 20 LOC. Please note that Small functions increases reusability than large functions because the percentage of intersection decreases according to the function size.

TL and DEV team

Source Code

New Functions Used

Updated Source code

17.    

If not typical, modify the function signature to meet the modification of the lines between groups, like changing the return value, function name, and function inputs.

TL and DEV team

Source Code

New Functioned Updated

Updated Source code

18.    

Repeat the steps until finish.

TL and DEV team

Source Code

All Process outputs

Updated Source code

19.    

For the repeated calls for the same sliced function,

Study why we need all these calls? In addition, can we replace it by member variables or not.

 

Ex:

1-Setting values for common controls events, like set focus and lost focus      

2-Getting values many times from different actions, you can get it once on form or view startup

TL and DEV team

Source Code

All Process outputs

Updated Source code

20.    

Re-measure the code metrics to find the variance, if not accepted, continue the process.

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

21.    

Separate business logic from the UI layer, so do not read from the UI in your business functions, read your UI elements and send the values to your business function in order to be used from class library.

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

22.    

Create new business module for each application, with the following name pattern:

Module+BL

Example:

Security module SecBL.dll

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

23.    

Update solution architecture models, and Re-architect classes according to the main and alternative scenarios and object lifecycle.[i]

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

24.    

Test Migrated Classes and operations

 

Ex:

1-Use unit testing methods

2-Regression testing before delivery to QC team

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

25.    

In order to apply MVC model, and prevent the intersection between UI and business, Move the completed classes to class library in process finalization, and use it from your application, considering that each group of classes related to the same business domain should have on class library.

 

For Example:

Security issues= Security library

BRM = Business rules manager layer

Stock TXN = Stock library

Encryption = Encryption Library.

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

26.    

MVC model be built upon the following method:

1.      Read from View

2.      Read and execute models behavior, so never inject your controller with business

3.      Write to view (with the model full signature, like returned values, messages and objects)

 

So, you should separate the Desktop operation to the mentioned functionality:

1.      ReadView

2.      ValidateView_CS

3.      ValidateView_SS

4.      Load[Object]Model

5.      UpdateModel

6.      UpdateView

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

27.    

All functions should have the following elements:

1.      A return, so void the void.

2.      Try and catch sections

3.      Logging for each step

4.      Logging for the exception section.

5.      Suitable return value according to the operation result.

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

28.    

For Performance Issues, do not log if the loop contains large number of records.

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

29.    

Encapsulate function behavior, so do not expect more function inputs [parameters] to support your function while you can get it inside.

For Example, sending the following parameter:

TXN Code, TXN Currency, while the currency is part of the TXN definition.

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

30.    

To prevent traffic consuming and locking issues, consolidate all operations that belongs to a main operation with facility to be run on the server.

Example:

Main and details insertion methods group them in one procedure and send all objects from the client once.

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

31.    

For All functions that are not related to the class responsibility, move it to the related class

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

 

 

 

 

 

 

 

 

 

 

 

 

 


 

 


 

Outputs

No

Output

Going To/Input Of

1

Update Source code

Updated files

2

Updated Models

EA Models

 

 

Measures

No

Output

Description

Rules

1

Maintainability index

To which level we have maintainable source code

0-100

The greater the best

2

Cyclomatic Index

It measures the number of branches in source code , like loops and if statements

increases according to the branches

the least is the best

3

Coupling

Measures the coupling to unique classes through parameters, local variables, return types, method calls, generic or template instantiations, base classes, interface implementations, fields defined on external types, and attribute decoration. Good software design dictates that types and methods should have high cohesion and low coupling. High coupling indicates a design that is difficult to reuse and maintain because of its many interdependencies on other types.

The least is the best

4

Depth of inheritance

Levels of inheritance

The least is the best

5

Lines Of Codes

Count the number of lines

The least is the best

 

 

 

 

 

 

 

 

 

 

Implementation guidelines

Each Class can have the following pattern of design as a reference with facility to change

 

S#

Method

Number of Similar Methods

1

LoadSetting

1

2

LoadDataFor+[SomeThing]

M

3

CreateObj

1

4

CreateObjDetail

M

5

UpdateObj

1

6

UpdateObjDetail

M

7

DeleteObj

1

8

ApproveObj

1

9

PostObj

1

10

Validate+[Something]

M

11

Check+[Something]

M

12

SearchForObject

1

 

 

 

 

 

Refactoring FE Activities

 

No

Activity

Responsible

Input

Output

Temp/Form

1.       

Separate resources (HTML, bootstrap, angular) to resource module

TL and DEV team

Source Code

Updated Source Code

 

2.       

Remove all functions with zero lines of codes

TL and DEV team

Free Errors code

Code Metrics Resuilts

VS 2013

3.       

How to get code metrics for java script

TL and DEV team

Free Errors code

Code Metrics Resuilts

VS 2013

4.       

Set client side architecture design according to CS operations like:

1-      Views_Validators

2-      Views_Generator

3-      BackEnd_Caller

 

 

 

 

5.       

Set Proposal for JS files design [as class design] from functionality perspective not UI perspective[4], according to its functionality using the following elements:

1.      UI

2.      Source code

TL and DEV team

Free Errors code

Understanding

Source Code

6.       

in order to increase reusability, Differentiate between the following types of functions:

1-      Functions that read and write from UI elements

2-      Function that execute behavior

3-      Functions that call backend code

TL and DEV team

Free Errors code

Understanding

Source Code

7.       

Slice the function to a set of functions according to the grouped lines

 

TL and DEV team

Source Code

New Functions created

Updated Source code

8.       

Set function maximum size to 10-15 lines to slice correctly and increase reusability

TL and DEV team

Source Code

New Functions Used

Updated Source code

9.       

Review functions behavior for consolidate, and change the signature as required

TL and DEV team

Source Code

New Functioned Updated

Updated Source code

10.    

In order to enable unit testing for JS functions, All functions should have the following elements:

1.      A return, so void the void.

2.      Try and catch sections

3.      Logging for each step

4.      Logging for the exception section.

5.      Suitable return value according to the operation result.

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

11.    

Review functions responsibilities, and move it to the related JS File

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

12.    

Review functions responsibilities and merge the similar with required modifications in method name and number of parameters

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

13.    

Create section for initialization of the JS file, to be handled as a constructor

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

14.    

Use JS objects for structured data types

var book = { "name": "The Principles of Object-Oriented JavaScript", "year": 2014 }; //object with json format

 

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

15.    

Use JQuery ready function to execute the startup code, variables  initialization, and events binding

$(document).ready(function () {

….}

 

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

16.    

Use session storage in order to save variable and prevent consuming  the backend calls

 

    var username = sessionStorage.getItem('UserName');

    sessionStorage.setItem('UserName', 'CM Manager');

 

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

17.    

Using [eval] for complicated and dynamic operations

function ExecuteEvalFunction()

{

    var vScript = "5+4";

    //var vScript = "5<4";

    $('#TXTInput').val("4");

    vScript = "$('#TXTInput').val()>3 && $('#TXTInput').val()<3";

    vScript = eval(vScript);//result will be 9

}

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

18.    

Use [RegExp] in order to validarte formats

function RegExpression()

{

    var v = new RegExp("http")

    alert(v.test("http://www.google.com"))

    window.alert(v.test("adsashsgfsd"))

 }

 

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

19.    

Migrate JS and JQuery to typescript in order to enable OO client side code

TL and DEV team

Updated Source code

All Process outputs

Updated Source code

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

04-Issue Resolving Procedure

Purpose

The objective of this procedure is to objectively settle a concrete solution based on clear inputs, for the raised issues by the quality team, either control or assurance.

 

Inputs

No

Input

Coming from/Output Of

1

Source Code

PD_Implementation

2

Issues

Issue Tracking system

 

Activities

No

Activity

Responsible

Input

Output

Temp/Solution

1.       

Take suitable work products for issue raiser.

Ex: Client Database from client.

TL and DEV team

Solution sources

Solution sources

 

2.       

Update all work products to latest version to prevent resolving old issues on old work products

 

Ex:

·        Database version

·        Procedures and functions

·        infrastructure components and DLL’s

 

TL and DEV team

Solution sources

Solution sources

 

3.       

Identify the issue in clear statement

TL and DEV team

Solution sources

Solution sources

4.       

Understand issue Analysis models if needed

TL and DEV team

Solution sources

Solution sources

 

5.       

Understand issue design models if needed

TL and DEV team

Solution sources

Solution sources

 

6.       

Conduct source code and database refactoring if needed

TL and DEV team

Solution sources

Solution sources

 

7.       

Identify the issue scenario in structured statement which includes:

·        Steps

·        Step inputs

·        Step outputs

TL and DEV team

Solution sources

Solution sources

 

8.       

Identify the issue history, and its impact on the system

TL and DEV team

Solution sources

Solution sources

 

9.       

Identify expected sources for the issue

TL and DEV team

Solution sources

Solution sources

 

10.    

Test the expected sources of the issues to find the given scenario

TL and DEV team

Solution sources

Solution sources

 

11.    

Conduct RCA to prevent such issues in the future according to each work product type building standards.

TL and DEV team

Solution sources

Solution sources

 

12.    

Consider user bad behavior not the correct one to resolve the issue, and create defensive model

TL and DEV team

Solution sources

Solution sources

 

13.    

Conduct RCA to resolve the issue impact on the solution according to each work product type building standards.

TL and DEV team

Solution sources

Solution sources

 

14.    

Identify alternative solutions to resolve the issue.

TL and DEV team

Solution sources

Solution sources

 

15.    

Select the optimum solution to resolve the issue according to the RCA

 

 

 

 

16.    

Refactor the business class or procedure according to the given business scenario.

TL and DEV team

Solution sources

Solution sources

 

17.    

Test alternative scenarios for the case

TL and DEV team

Solution sources

Solution sources

 

18.    

Test the main scenario that includes the given issue scenario

TL and DEV team

Solution sources

Solution sources

 

19.    

Take corrective actions to resolve issues impact on the main and alternative scenarios including Arabic and English UI to confirm the consistency between different interfaces.

TL and DEV team

Solution sources

Solution sources

 

20.    

Retest the resolution and conduct required changes during the retest step

TL and DEV team

Solution sources

Solution sources

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Outputs

No

Output

Going To/Input Of

1

Updated source code with the resolved issues

Updated Source code

2

Updated Models

EA Models

3

Updated tracking system status

Tracking system

 

 

 

 

 

 

 

 

 

 



[1] - Each class you create costs money to maintain and understand. A class that is not doing enough to pay for itself should be eliminated. Remove them, and do not pay for nothing.

[2] - like calculating value each time for the same thing according to the same equation, so you can put it in a separate property or method, it is the way of organizing data. You should hide all details of the field like how you calculate it and what is the real value according to which condition.

 

[4] - For Example: function name should be CheckCurrencyCode, not txtCurr_Validate, AddingNewLine, not grid_row_add