Author Archives: Shsms Al Farees

Path Testing & Graph

what is Path Testing? It is a way or a method of testing to ensure that all the lines in the program is executed once at least. There is Program Graphs, Decision-to-Decision (DD) Paths, Test Coverage with Program Graphs and DD-Path Graphs

From the blog CS@Worcester – Shams's Bits and Bytes by Shsms Al Farees and used with permission of the author. All other rights reserved by the author.

FINAL PROJECT SECOND BLOG

This week we started to code our project, after we finished the UML design now we have the map to our code. Also we are using GitLab to share our work, each time any one of us is done with a part of the code we just push it to GitLab so every one can … Continue reading FINAL PROJECT SECOND BLOG

From the blog CS@Worcester – Shams's Bits and Bytes by Shsms Al Farees and used with permission of the author. All other rights reserved by the author.

Another Example for the Decision Table Test Design Technique

we can use the following function to create a decision table. int discountcommission(double price, int items) returns the percent discount , when given the price of the items. Items Discount Commission items < 100%15 ≤ items ≤ 506%51 < items 12% for all sales that’s over $1000.00 additional 1% discount will be given. Let’s try … Continue reading Another Example for the Decision Table Test Design Technique

From the blog CS@Worcester – Shams&#039;s Bits and Bytes by Shsms Al Farees and used with permission of the author. All other rights reserved by the author.

Final Project First Blog

The first task for the project was the “Proposal”

This is the first week that we started working on the final project for CS343 Software Constr, Des & Archit, my team and I decided to create a simulation for a the order system that we were working on during the semester.

We started by putting the proposal, dividing the work between us and agreed on the layout for the design. However, we always can change the layout after we are done with all the coding.

Our project will be about creating a simulated operating system that will be running on a Spring Boot Rest API server and will have an angular user interface.

The important steps that we will fellow during the time we are working on the project:

  • The first step will be to design web page layout.
  • Then start working on the the operating system java code.
  • The first two steps can be done at the same time. 
  • The next step will be to implement the rest API on the operating system java code .
  • And in the end the last step will be to write the typescript in the angular app to interact will the rest API.

We agreed that the project will be divided into: in the top there will be one upper menu that will have three buttons one to load the job, one to clear the job input and one to run the next instruction. On the both sides of the app page these will be the first pull down text box to add instructions for a new job and on the other side there will be a table that shows the whole memory table. And for sure there will be output text box.

The data type that will be used in the project for each component is: The input and the memory table will be arrays of strings and the output will be a string.

From the blog CS@Worcester – Shams&#039;s Bits and Bytes by Shsms Al Farees and used with permission of the author. All other rights reserved by the author.

Decision table test design technique

Decision table also known as cause effect
table it is one of the black box test design techniques

what are that black box design techniques?

Black Box Testing is a software testing method in
which the internal structure/ design/ implementation of the item being tested
is NOT known to the tester. The black box is designed techniques are widely used as a best
practice in the industry. Black box techniques are used to pick the test cases
in a systematic manner by using these techniques we could save lots of testing
time and get the good coverage.

 Decision Table Test Case Design Technique:

This test technique is appropriate for functionalities where it has the logical relationships between the inputs (if-else logic). In Decision table technique, we are working with a combination of inputs. To identify the test cases with decision table, we have conditions and actions. We take conditions as inputs and actions as outputs.

As an example, for that lets practice on a small test case which is Login Screen

Let’s identify the conditions our inputs:

The user will type in the correct username and password, the user will be logged in successfully

If any of the input is wrong, an
error message will be displayed.

Now let’s divide our condition in to
true, false, error, and home screen

  • T for true – Correct username/password
  • F for false– Wrong username/password
  • E for error– Error message is displayed
  • H for home– Home screen is displayed

That leads us to the cases we are going to create:

  • Case 1 – Username and password both were wrong. The user is shown
    an error message.
  • Case 2 – Username was correct, but the password was wrong. The user
    is shown an error message.
  • Case 3 – Username was wrong, but the password was correct. The user
    is shown an error message.
  • Case 4 – Username and password both were correct, and the user
    navigated to homepage

Now let’s try to put all of this
into one decision table  

conditions Rule1 Rule2 Rule3 Rule4
Username F T F T
password F F T T
Output E E E H

And this is the way to create a decision table

Advantage of decision table technique:

  1. every complicated business can be converted easily into a
    test scenarios & test cases using this technique.
  2. The first iteration is used as input table for next
    tables.
  3. Once you get the idea of how the test works it become simple
    to understand and anyone can use this method.
  4. It gives a full coverage of test cases which help to
    reduce the rework.

 

 

Works Cited

From the blog CS@Worcester – Shams&#039;s Bits and Bytes by Shsms Al Farees and used with permission of the author. All other rights reserved by the author.

SOLID Principles

This will be two parts post, I will talk about the SOLID principles and try to cover all of them from the way I understand SOLID,

First SOLID was introduced by Robert C. Martin (Uncle Bob), in his 2000 paper Design Principles and Design Patterns. Uncle Bob also well known for his book Clean Code, I studied this book in my CS-338 class, it was great book in changing the way of coding. and how to writ a clean code.

Going back to SOLID. SOLID is a shortening for 5 important design principles Object Oriented Programming

S — Single responsibility principle

O — Open/closed principle

L — Liskov substitution principle

I — Interface segregation principle

D – Dependency inversion principle

I will talk about the first tow principles in this post.

Single responsibility principle

It means that every class and module should be responsible
or have responsibility of a single part of the software functionality. It is
like do one thing and do it well. Uncle Bob defines a responsibility as a ‘reason
to change’ which means that the class or the module don’t need more than one reason
to be change.

For example lets look to this code:

This code violates the SOLID first principle, the method CreateBlog() has to do many responsibilities, create a Blog, and log an error in the DB and also log an error in the file. which is absolutely the opposite of the Single responsibility principle

class Author
{
void CreateBlog(Database db, string publishtText)
{
try
{
db.Add(publishtText);
}
catch (Exception ex)
{
db.LogError(“There is an Error: “, ex.ToString());
File.CheckAllText(“There is a Local Errorn in.txt”, ex.ToString());
}
}


Lets try to fix the problem in the code above.

class Blog
{
private ErrorLogger errorLogger = new ErrorLogger();

void CreateBlog(Database db, string publishtText)
{
try
{
db.Add(publishtText);
}
catch (Exception ex)
{
errorLogger.log(ex.ToString())
}
}
}

class ErrorLogger
{
void log(string error)
{
db.LogError(“There is an Error: “, error);
File.CheckAllText(“\There is a Local Errorn in.txt”, error);
}
}

We created two classes each one of them will handles one responsibility,
and that will no longer violate the single responsibility principle.


Open/closed principle

It means that the software entities (classes, modules, functions, ….) has to be closed for modification however has to be open for extensions.

We know from the Object-Oriented Programming or OOP, the polymorphism , and I posted a blog explaining about polymorphism. In another word we need to create inheritance or implementing an interfaces in the code to make sure it is compliant with the open/closed principle

lets look to this code and see whether it is applying the Open/closed principle

class Blog
{
void CreateBlog(Database db, string publishtText)
{
if (publishtText.StartsWith(“!”))
{
db.AddAsTag(publishtText);
}
else
{
db.Add(publishtText);
}
}
}

What we want in this code is to do a exact one thing which is the every time a published Text start with the character ‘!’, the code is violates the open/closed principle. If in the future we needed wanted to include mentions all the published text starting with ‘#’, then modifying the class with an another ‘else if’ is a must added to the method().

Lets try to fix the problem in the code above.

class Blog
{
void CreateBlog(Database db, string publishtText)
{
db.Add(publishtText);
}
}

class TagText : Text
{
override void CreateBlog(Database db, string publishtText)
{
db.AddAsTag(publishtText);
}
}

It is much easier to create extended behavior to the Blog object by using inheritance and overriding the CreateBlog() method.

That is all I have for this week, and next week I will continue on the SOLID principles and talk about the other three principles .

From the blog CS@Worcester – Shams&#039;s Bits and Bytes by Shsms Al Farees and used with permission of the author. All other rights reserved by the author.

Object-Oriented Design Principles

In CS-343 activity 2 we talked about the Object-Oriented Design Principles. But let us stop at Object-Oriented
Design to understand what it is:

Object-Oriented Design is the process of development a system of interacting for solving a software problem. It is software design approach.

In the Object-Oriented Design there are many Principles

  • Polymorphism:

Polymorphism
is a OOPs concept where one name can have many forms. for example we use smart
phones for communication, the communication mode we use could be anything like
call, text massages, emails etc… so the goal is one which is communication,
however the approach is different. And this what Polymorphism is bout. In order
to achieve Polymorphism, we use the overloading ( Static Polymorphism) and
overriding methods (Dynamic Polymorphism) for that.

  • Inheritance:

Inheritance
is a mechanism, in which, one object obtains all the properties and behaviors
of the parent objects. We can reuse the methods and the fields of the parent
class. And also, we can add new methods and classes to the inheritance. Inheritance
represents the parent-child relationship

  • Encapsulation:

When
the developers are in the final stages of wrapping code and data into one single
unite that known by Encapsulation.

We
can create fully encapsulation class by making all the data members of the class
private. For that we will use setter and getter methods to set and get the data
in it.

The
encapsulation will give the developer the control over the data, and it is a
good way of data hiding where other classes will not be able to access the data
through the privet data members, also the encapsulation class is better for
unit testing because it is easy to test.

  • Abstraction:

Abstraction
means hiding the details and display the important information only. there are
two ways to achieve abstraction in java

  1. Abstract class 0-100%. When the abstract class is declared, the class could have abstract or non-abstract methods in it.
  2. Interface 100%. It usually used to achieve abstraction and multiple inheritance in java. In interface there should be only object methods in the interface not method body.
  • Class:

The class can be defined as a group of objects that have a common properties. We can say it is a template where the objects are created. For that we can say it is a logical entity but not physical.

  • Object:

The
object is known as an entity that has a known state and behavior. There are
characteristics related to the Object:

  1. State:
    which will present the data of an object
  2. Behavior:
    which will present behavior of an object
  3. Identity:
    which will used to identify each object uniquely.
  • Method:

The
methods are more like the functions, which are used to expose the behavior of
an object. The advantages of having the methods are:

  • Cod reusability
  • Code optimization
  • Methods are defined in the class
  • Methods provided method overriding
  • Message Passing

It is a way of communication between processes. it is like sending an object message from one thread to another thread.  

From the blog CS@Worcester – Shams&#039;s Bits and Bytes by Shsms Al Farees and used with permission of the author. All other rights reserved by the author.

What is the difference between Object-oriented modelling and UML

To found about the different between OOM and UML we need to
understand the definition of both.

Objectoriented Modeling according
to Wikipedia the OOM:
is an approach to modeling an application that is
used at the beginning of the software life cycle 

UML: Stands for “Unified Modeling Language. The purpose of UML is visually representing a system along with its main actors, roles, actions, artifacts or classes, in order to better understand, alter, maintain, or document information about the system. We can say that UML is the new approach for documenting and modeling the software

Object-oriented modelling:

  • It is the process of construction
    of objects.
  • objects contain stored values of
    the instance variables.
  • creates the union of the
    application and database development.
  • The union is then transformed
    into a unified data model.
  • This approach makes object identification
    and communication easy.
  • Supports data abstraction,
    inheritance and encapsulation
  • Modelling techniques are
    implemented using OOP supporting languages.
  • OOM consists of following three
    cases:

    • Analysis
    • Design
    • Implementation

UML:

  • UML stands for Unified Modelling
    Language.
  • It is the standardised modelling
    language.
  • Helps the development being
    scalable, secure and robust
  • Implemented using OOP supporting
    languages.
  • Uses graphic notations to create
    visual models of software system
  • Can be deployed to multiple
    platforms with different technologies
  • Can be used throughout the
    software development cycle.
  • Supports frameworks,
    collaborations and patterns(development concepts)
  • Represents Static and Dynamic
    views of a system model
  • Examples of UML tools include
    Rational Rose, Dia, MagicDraw UML etc.

From the blog CS@Worcester – Shams&#039;s Bits and Bytes by Shsms Al Farees and used with permission of the author. All other rights reserved by the author.

Software Construction, Design and Architecture for Design Patterns

The Creational

The object creation and or the class instantiation is
the core center of the design patterns, the design patterns will be divided
into object-creational and Class-creational patterns. The Class-creational use
inheritance during the process, however the object-creation uses the delegation
during the process to finish the task.

The Creational Design patterns:

  • Abstract
    Factory
  • Builder
  • Factory
    Method
  • Object
    Pool
  • Prototype
  • Singleton

To make this clear I found this example on Geeks for
Geeks web site (Abhijit Saha).

When a developer design simple DBConnection class to
use it to connect into a database, he will the access the database at multiple
locations from code. That will be by creating an instance of DBConnection class
and it will be used to do database operations as needed. Which results in creating multiple
connections from the database as each instance of DBConnection class will have
a separate connection to the database. In order to deal with it, we create DBConnection class as a singleton class, so that only
one instance of DBConnection is created and a single connection is

The Structural

What the design patterns do, is forming or more on organizing
the multiple classes and objects which will create the structures which will
provide the new functionality.

Structural design patterns are:

  • Adapter
  • Bridge
  • Composite
  • Decorator
  • Facade
  • Flyweight
  • Private
    Class Data
  • Proxy

Another Example is here to show how the Structural
design patterns are working (Abhijit Saha).

If there are incompatible interfaces and the developers
want to make establish a relationship between them through an adapter it’s
called adapter design pattern. Adapter pattern converts the interface of a
class into another interface or classes.

The Behavioral

all what the Behavioral
patterns are about is recognizing and identifying the common communication
patterns between objects.

Template
pattern defines the skeleton of an algorithm in an operation deferring some
steps to sub-classes, Template method lets subclasses redefine certain steps of
an algorithm without changing the algorithm structure. (Abhijit Saha).

The Behavioral patterns are:

  • Chain of responsibility
  • Command
  • Interpreter
  • Iterator
  • Mediator
  • Memento
  • Null Object
  • Observer

The Concurrency Patterns

The choice of
concurrency architecture has a significant impact on the design and performance
of multi-threaded networking middleware and applications.

The Concurrency Patterns are:

  • Active Object
  • Monitor Object
  • Half-Sync/Half-Async
  • Leader/Followers
  • Thread-Specific Storage
Works
Cited

Abhijit Saha, Tanuja Praharaj. Design Patterns.
2015.
<https://www.geeksforgeeks.org/design-patterns-set-1-introduction/&gt;.

Babu, Dinesh. DESIGN PATTERNS Creational design patterns.
n.d. <https://www.academia.edu/37967381/DESIGN_PATTERNS_Creational_design_patterns&gt;.

Mallawaarachchi, Vijini. 10 Common Software Architectural
Patterns in a nutshell
. 2017.
<https://towardsdatascience.com/10-common-software-architectural-patterns-in-a-nutshell-a0b47a1e9013&gt;.

From the blog CS@Worcester – Shams&#039;s Bits and Bytes by Shsms Al Farees and used with permission of the author. All other rights reserved by the author.

What is Software Quality Assurance and Testing!

I will keep adding what I understand and found on Software Quality Assurance and Testing in this page

The Software Quality Assurance and Testing!includes activities that ensure the implementation of processes, procedures and standards in context to verification of developed software and intended requirements. … Focuses on processes and procedures rather than conducting actual testing on the system.

From the blog CS@Worcester – Shams Al Farees by Shsms Al Farees and used with permission of the author. All other rights reserved by the author.