Featured

Welcome To My Blog

Hello everyone, my name is Shams and this is my first post in this blog!

I’m a Computer science major at Worcester State University, I’m from Iraq, my family and I left Iraq in 2006 and we traveled a lot until 2009 when I settled down in Malaysia south-east Asia where I started studying software engineering in 2011, I came to USA few years ago and I managed to transfer almost all my studying credits to Worcester State University, the CS department helped me a lot in the transfer process .

I have two handsome boys, they are the joy in my life, Layth is 8 years now he is in 3rd grade and Sam is almost 3, he is going to pre-school this year, I’m a full-time student and I’m working at the Students Career Services at Worcester State University.

I love reading fictional novels and now I’m enjoying my free time reading GOT, it was my favorite TV show….

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

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 .

JUnit 5 Programming Model

Today we are going to talk about the JUnit 5 Programming Model

There are the three basic models that comprise the JUnit 5 Programming Model which are

1-JUnit Platform 

2- JUnit Jupiter 

3- JUnit Vintage

The JUnit Platform: serves as a foundation for launching testing frameworks on the JVM. It also defines the Test Engine API for developing a testing framework that runs on the platform.

JUnit Jupiter: The Jupiter sub-project provides a TestEngine for running Jupiter based tests. Which is also made of a combination of the new programming model and extension model 

JUnit Vintage provides a TestEngine for running JUnit 3 and JUnit 4 based tests on the platform.

Why was the Extension Model named Jupiter

So, the name came from our solar system, Jupiter is the 5th plant in our solar system, and the Juint5 is the perfect match to the name since they didn’t wanted to make it with numbers, because any adding to it will make no point for having numbers over numbers that, we agree that the Jupiter is the new programming &the new extension model for the juint5.

There are differences/advantages of JUnit 5 over JUnit 4.

 Junit 4  Junit 5
Assumptions In Junit 4, org.junit.Assume contains methods for stating assumptions about the conditions in which a test is meaningful. It has following five methods: assumeFalse()assumeNoException()assumeNotNull()assumeThat()assumeTrue() Assumptions In Juint5 , org.junit.jupiter.api.Assumptions contains methods for stating assumptions about the conditions in which a test is meaningful. It has following three methods: assumeFalse()assumeThat()assumeTrue()  
Assertions In Junit 4, org.junit.Assert has all assert methods to validate expected and resulted outcomes.
They accept extra parameter for error message as FIRST argument in method signature.  
Assertions In JUnit 5, org.junit.jupiter.Assertions contains most of assert methods including additional assertThrows() and assertAll() methods. assertAll() is in experimental state as of today, and is used for grouped assertions.
JUnit 5 assertions methods also have overloaded methods to support passing error message to be printed in case test fails 
JUnit 4 has everything bundled into single jar file JUnit 4 has everything bundled into single jar file
Junit 4 requires Java 5 or higher.   Junit 5 requires Java 8 or higher  
In Junit 4, @category annotation is used. In Junit 4, @RunWith and @Suite annotation. In Junit 5, @tag annotation is used. In Junit5 , @RunWith@SelectPackages and @SelectClasses

The lambda (λ) expression

We can say that Lambda expression is a function that has no name. we can make Lambda where it does not need to be part of class. Lambda expression is a new and important feature of Java which was included in Java SE 8. It provides a clear and concise way to represent one method interface using an expression. It is very useful in collection library. It helps to iterate, filter and extract data from collection. Lambda can provide the implementation of Functional interface. Also, using Lambda means Less coding.

I found this example of Lambda on Java T Point

The lambda expression that selected members who are male and between the ages of 18 and 25 years: p -> p.getGender() == person.sex.MALE

     && p.getAge() >= 18

    && p.getAge() <= 25

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.  

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.

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;.

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.

Let’s Talk about Software Construction, Design and Architecture

The software needs the architectural design to represents the design of software. IEEE defines architectural design as “the process of defining a collection of hardware and software components and their interfaces to establish the framework for the development of a computer system.”

What is Software Construction?

we can say that Software Construction is all the collection of programs, processes and all the information and data that used to perform different tasks within the building or creating of a structure as a means of increasing productivity, efficiency and competitiveness.

Software construction fundamentals include

  1. Minimizing complexity the code should be simple and readable
  2. Anticipating change the code might be change in any time.
  3. Constructing for verification (API).
  4. Reuse “Construction for reuse” and “Construction with reuse”.
  5. Standards in construction.

Create your website at WordPress.com
Get started