100% found this document useful (1 vote)
166 views

Hawassa University: Hawassa University Institute of Technology Department of Information Technology

The document summarizes the algorithm design and coding procedures for an industrial project completed by six students at Hawassa University. It describes key classes used in the project, including ActivityCustomerLogin for user login, FragmentLoadServiceProviders for retrieving service providers from a database, and Constants for shared properties. It also outlines the coding standards and principles followed, such as naming conventions and ordering of class members.

Uploaded by

Tinsae Tadese
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
166 views

Hawassa University: Hawassa University Institute of Technology Department of Information Technology

The document summarizes the algorithm design and coding procedures for an industrial project completed by six students at Hawassa University. It describes key classes used in the project, including ActivityCustomerLogin for user login, FragmentLoadServiceProviders for retrieving service providers from a database, and Constants for shared properties. It also outlines the coding standards and principles followed, such as naming conventions and ordering of class members.

Uploaded by

Tinsae Tadese
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

HAWASSA

UNIVERSITY

HAWASSA UNIVERSITY
INSTITUTE OF TECHNOLOGY DEPARTMENT OF
INFORMATION TECHNOLOGY

Industrial project 2

Group members ID.NO


1. Tinsae Tadese…………………….IT/0063/09
2. Abeye Deriba……………………..IT/0007/09
3. Abdi Tsegaye……………………..IT/0001/09
4. Eshak Sani………………………...IT/0076/09
5. Endash Denbel…………………….IT/0021/08
6. Amsalu Kebede…………………….IT/0017/09

Advisor: Mr. Tewodros T.


Declaration

This is to certify that I have read this project and that in my opinion it is fully adequate, in scope
and quality, as a senior project for the degree of Bachelor of Science.

Mr. Tewodros Tilahun ----------------------


Name of Advisor signature

Examining committee members’ name, signature and date


1. Chairman:
Name _______________________ Signature _______________ Date __________
2. Examiner 1:
Name _______________________ Signature _______________ Date __________
3. Examiner 2:
Name ________________________ Signature ________________ Date __________
4. Examiner 3:
Name________________________ Signature ________________ Date __________
Acknowledgment

First and foremost, we are very grateful to the almighty God for letting us finish our final
year industrial project one and give us strength that we need in order to fulfill our duty as
an Information Technology student.

Here, we wish to express our sincere appreciation to our advisor, MR. Tewodros Tilahun,
for encouragement, guidance, suggestions, critics, and friendship throughout finishing
this project.

Thanks also to all of the kind lecturers in the Department of information technology for
their accommodation, suggestion, and opinion during the project progress in university.
In particular, we would like to thank all the staff and lab assistants, for their cooperation,
indirect or direct contribution upon completing our project.
Table of Contents
Acknowledgment.........................................................................................................................................3
INTRODUCTION...........................................................................................................................................5
ALGORITHM DESIGN..............................................................................................................................5
Class ActivityCustomerLogin..................................................................................................................5
Class FragmentLoadServiceProviders.....................................................................................................6
Class Constants........................................................................................................................................6
CODING PROCEDURES...........................................................................................................................7
Coding standards and principles..............................................................................................................7
CODING PROCESS.................................................................................................................................11
TESTING STATEGY...............................................................................................................................11
Unit Testing...........................................................................................................................................11
Integration Testing.................................................................................................................................12
System Testing......................................................................................................................................12
Structural testing....................................................................................................................................13
SECURITY OF THE SYSTEM................................................................................................................14
System Maintenance and documentation...............................................................................................15
Availability............................................................................................................................................15
Corrective Maintenance.........................................................................................................................15
Preventive Maintenance........................................................................................................................15
Perfective Maintenance.........................................................................................................................15
INTRODUCTION
The implementation phase represents the work done to meet the requirements of the scope of
work and fulfill the charter. During the implementation the project team accomplished the work
defined in the plan and made adjustments when factors changed. This is what we call software
implementation. The purpose of these activities is to convert the final physical system
specification into working model with reliable software and hardware, document the work that
has been done, and provide help for current and future users and take care of the system.

ALGORITHM DESIGN
Algorithm design is a sequence of steps to solve a problem and approaches to meet the
requirements of our system. The following sample used algorithm design way of our system. It is
just similar with our code functionality and validity. There are so many different classes in our
system, but we selected very few of them to justify the way of algorithm the system follows. The
algorithm we used is pseudo code.

Class ActivityCustomerLogin
The activity customer login class has properties and methods to hold user account information
and process the information according to the system logic.

Properties

Private String UserName;

Private String password ;

Method

Private Boolean inputValidation(String userName, String password) –it checks the


validity of account and password.

Precondition: provided information should not empty and should match the required format.

Post condition: account information will be valid.


BEGIN

ACCEPT user account and password

VALIDATE user account and password


IF VALID communicate to the database

THEN

DISPLAY the operation is successful.

ELSE

DISPLAY the operation is not successful.

ENDIF

END

Class FragmentLoadServiceProviders
Class FragmentServices is used to retrieve services found in the database.

Methods

loadServices- it is used to retrieve service providers in the database.

Precondition: the customer must specify the service he / she want.

Post condition: load the service provider in the specified services category from the database.

BEGIN

ACCEPT the requested service id.

SEND the data to the server.

IFEXIST retrieve data and display to the user.

ELSE

DISPLAY no service providers under requested service.

ENDIF

END

Class Constants
This class holds the properties and methods that can be as an input and processing class for other
classes.

Properties

ROOT_URL- holds the root URL.


Other page specific URL – by binding their specific Url to the root Url.

Shared preferences Name and Mode.

Methods

encryptData

BEGIN

ACCEPT the plain data.

PROCESS the plain data.

RETURN the cipher data.

CODING PROCEDURES
Coding standards and principles
We use java programming for and XML for the android and use HTML, PHP, JAVASCRIPT
AND CSS for the website. We followed the standard naming conventions, Standards and
Principles for each programming language. The examples in the following naming principles and
rules are taken from our project.

1. Naming and Coding Rules in java

Packages

It should be a lowercase letter and if it contains multiple words it should be separated by dots (.).

Ex. package com.example.huluhome;

Class

It should start with the upper case letter and it should be nouns. Ex. public class Constants

Constants

It should be in upper case letters.

Ex. private final static String ROOT_URL="http://192.168.137.1:8080/huluHome/V1/";

Variables

It should start with lower case Ex. FragmentManager fm;

Methods
It should start with lower case letter. Ex. private void loadFeedback();

Oder to follow

Use the following order to declare members of a class or Activity in Android studio:
 Class variables (static members).
 Instance variables.
 Class Methods (protected methods)
 Other methods

Sample code from the project according to the rules above.

package com.example.common;

public class Services {

private int serviceId;

private String serviceType;

private String servicePhoto;

public Services(int serviceId, String serviceType, String servicePhoto) {

this.serviceId = serviceId;

this.serviceType = serviceType;

this.servicePhoto = servicePhoto;

public int getServiceId() {

return serviceId;

public String getServiceType() {

return serviceType;
}

public String getServicePhoto() {

return servicePhoto;

@Override

public String toString() {

return "Services{" +

"serviceId=" + serviceId +

", serviceType='" + serviceType + '\'' +

", servicePhoto='" + servicePhoto + '\'' +

'}';

Naming Important Libraries

import androidx.appcompat.app.ActionBar;

import androidx.appcompat.app.AppCompatActivity;

import androidx.appcompat.widget.Toolbar;

import androidx.core.app.ActivityCompat;

import androidx.fragment.app.FragmentManager;

import com.android.volley.VolleyError;

import com.android.volley.toolbox.JsonArrayRequest;

import com.android.volley.toolbox.StringRequest;

import com.bumptech.glide.Glide;
import com.example.common.Constants;

import com.example.common.MySingleton;

CODING PROCESS
Incremental Coding Process

The coding activity starts when some form of design has been done and the specifications of the
modules to be developed are available. Throughout our project we used the incremental coding
process. The incremental coding process is a coding process often used by experienced
developers.

We first wrote the code for implementing only part of a functionality of a module. We then
compiled and tested with some quick tests to check the code. When the code passes these tests,
we added further functionality to the code, which is then tested again. In other words, we built
the code incrementally, testing it as we built it. For example first we try to connect to the
database and then test if the connection is successful and then try to do CRUD operations and
test the operation and so on.

TESTING STATEGY
The test plan is designed to analyze the logic used in the implementation of the Android Based
home to home service system app. The tests will allow us to ensure correct program flow, and to
determine the error-handling capability of the system.

Unit Testing
Unit test is a way of testing each of the system functionality independently. Accordingly our
group member has tested each one of the three major activities. The first is accompanying
activities independently using different user input, the second is different login mechanisms and
any technique of fault finding so that an incorrect functioning of the activities was corrected at
the right time.
Integration Testing
By combining each individual form and report with their concerned database we had tested by
giving general data. From this we had understood and realized that how the system works using
separate module.

System Testing
It is the final step of testing. In this system tested the entire system as a whole with all forms,
code, modules. In this we tested all the functionalities in the System. All errors in the forms,
functions, modules have been tested. Finally by the system testing we had ensured that the entire
integrated software system meets the desired requirements.

Test Case 1 –Service Provider Authentication

Test Case ID = SrPrT1


Unit to Test = Authentication of Service Provider
Assumptions = Redirects to Home Activity
Test Data
username (valid username, invalid username, empty)
Password (valid password, Invalid password, empty)
Structural testing
In structural testing we tested the structure of the code and how the code works to perform a
specific activity. We have structural testing as programmers to test how the each code works. For
example in our system we have tested a conditions and flow of code to log into the admin system
including displaying error message to the admin.
SECURITY OF THE SYSTEM
So in order to make our website secure we followed the following methodologies.

System level security

 Input data validation: We are going to validate inputs a person gives to login into the
admin page in server side PHP for validation. Because if we put our validation in
JavaScript some browser would allow the intruders to turn off the JavaScript on that
browser.
 Password encryption: We use Md5 to encrypt the password data on a data base so no
one can access the password stored on the database since md5 hasher is a one-way
inscription method.
 Proper error handling: It’s good to know all the errors that occur while we are
developing a website, but when we make the application accessible to end users we
should take to hide the errors. If errors are shown to users, it may make our application
vulnerable. So, we will configure our server differently for development and production
environments.

 Protecting session data: To protect session data we encrypt the information stored in
the session.

 Preventing SQL Injection attacks: To prevent SQL injection so as the attacker can’t
inject malicious SQL query, we used php methods like mysqli_real_escape_string() in
order to prevent the system from being attacked by malicious codes entered in forms.
This way we can make our system secures. Using Prepared statements/parameterized
query.

Database level encryption


Authentication: - preventing any user from accessing our database except for the one
with correct credentials.
Access:-Access includes designing and granting appropriate user attributes and roles and
limiting administrative privileges.
System Maintenance and documentation

Availability
 We will ensure availability by rigorously maintaining all hardware, performing hardware
repairs immediately when needed and maintaining a correctly functioning operating
system environment.
 Primary methods that we will use to protect against loss of availability are fault tolerant
systems, redundancies, and backups. Fault tolerance means that a system can develop a
fault, yet tolerate it and continue to operate. Backups ensure that that important data is
backed up and can be restored if the original data becomes corrupt.

Corrective Maintenance
We will conduct corrective maintenance which involves repairing of faults and basically errors
in design, logic or coding in the daily system functions.

Preventive Maintenance
We will conduct Preventive maintenance which is essentially the intervention that is focused on
reducing or eliminating the occurrence of errors.

Perfective Maintenance
• As the end users use the system, certain new or changed user requirements are
discovered. We will conduct Perfective maintenance which takes those feedbacks into
account.

Server side Sample codes

Database connection

Constants.php
<?php
define('HOST','localhost');
define('USER','root');
define('PASSWORD','');
define('DB_NAME','huluhome');

?>

DbConnection.php

<?php

define('ERROR','Error Occured');
class DbConnection
{

private $conn;
function __construct()
{

}
function connectDb()
{
include_once dirname(__FILE__).'/Constants.php';
$this->conn = new mysqli(HOST,USER,PASSWORD,DB_NAME);
if(mysqli_connect_errno())
{
echo ERROR.mysqli_connect.err();
}

return $this->conn;
}
}

Dboperation.php

<?php
class DbOperation {

function __construct(){
require_once dirname(__FILE__). '/DbConnection.php';
$db = new DbConnection();
$this->conn = $db->connectDb();

function loadServices(){
$statement =$this->conn->prepare("SELECT * FROM `services` ");
$statement->execute();
$result = $statement->get_result();
if($result->num_rows>0)
{
while($row=$result->fetch_all(MYSQLI_ASSOC))
{
$this->services=$row;
}
return 1;
}
return 0;
}

loadService.php

<?php
require_once '../Includes/DbOperation.php';
$response =array();

if($_SERVER['REQUEST_METHOD']=='POST')
{
$db = new DbOperation();
if($db->loadServices())
{
$counter=0;
foreach($db->services as $row)
{
$row['photo'] = base64_encode(file_get_contents("../uploadServices/".
$row['photo']));
$serviceProviders[$counter++]=$row;

}
}
else{
$response['error']=true;
$response['msg']="The server request method is not post!!";

}
//echo json_encode($response);
echo json_encode($serviceProviders);

Client Side Sample Codes

Constants.java

package com.example.common;

import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import android.provider.DocumentsContract;

import android.util.Base64;

public class Constants {

private final static String ROOT_URL="http://192.168.137.1/huluHome/V1/";

public final static String userRegistrationUrl=ROOT_URL+"RegisterUser.php";

public final static String verificationCodeURL=ROOT_URL+"verificationCode.php";

public static final String isLogged = "UserLoggedIn";


public static final String LoginPreference = "LoginPreferences";

public static final int LoginPreferencesMode = 0;

FragmentService.java

package com.example.huluhome;

public class FragmentServices extends Fragment implements


Response.Listener<JSONArray>,Response.ErrorListener

, RecyclerAdapterMaker.OnItemClickListener {

public static final String CATEGORY_EXTRA ="category";

ProgressDialog progressDialog ;

SharedPreferences preferences;

//widget

ImageView img;

//widgets from the dialog

RadioButton knowLocation;

RadioButton differentLocation;

RadioGroup radioGroup;

Button selectLocation;

//holder

public int serviceId;

RecyclerView recyclerview;

/*List<Bitmap> image = new ArrayList<>();

List<String> category = new ArrayList<>();


List<Integer> price = new ArrayList<>();*/

ArrayList<Services> listOfServices;

int counter;

RecyclerAdapterMaker recyclerAdapterMaker;

@Override

public View onCreateView(LayoutInflater inflater, ViewGroup container,

Bundle savedInstanceState) {

// Inflate the layout for this fragment

listOfServices = new ArrayList<Services>();

View view = inflater.inflate(R.layout.fragment_services, container, false);

recyclerview = view.findViewById(R.id.recyclerForServices);

recyclerview.setHasFixedSize(true);

GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(),2);

recyclerview.setLayoutManager(gridLayoutManager);

listOfServices = new ArrayList<>();

progressDialog = new ProgressDialog(getContext());

loadServices();

return view;

public void loadServices() {

progressDialog.show();

progressDialog.setContentView(R.layout.layout_progress_dialog);
progressDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);

JsonArrayRequest jsonArrayRequest;

jsonArrayRequest = new JsonArrayRequest(Request.Method.POST,


Constants.LoadServicesUrl,

null, this, this);

MySingleton.getInstance(getContext()).addToRequestQueue(jsonArrayRequest);

@Override

public void onErrorResponse(VolleyError error) {

progressDialog.dismiss();

Toast.makeText(getContext(), error.getMessage(), Toast.LENGTH_LONG).show();

@Override

public void onResponse(JSONArray response) {

progressDialog.dismiss();

// Toast.makeText(getContext(),response.toString(),Toast.LENGTH_LONG).show();

try {

processJsonArray(response);

} catch (JSONException e) {

e.printStackTrace();

private void processJsonArray(JSONArray response) throws JSONException {

JSONObject jsonObject;
for (int i = 0; i < response.length(); i++) {

jsonObject = response.getJSONObject(i);

int serviceId = jsonObject.getInt("serviceId");

String serviceType = jsonObject.getString("serviceType");

String servicePhoto = jsonObject.getString("photo");

listOfServices.add(new Services(serviceId, serviceType, servicePhoto));

recyclerAdapterMaker = new RecyclerAdapterMaker(getContext(), listOfServices);

recyclerview.setAdapter(recyclerAdapterMaker);

recyclerAdapterMaker.setOnItemClickListener(this);

@Override

public void onItemClick(int position) {

openDialog();

Intent sP = new Intent(getActivity(),ActivityServiceProviderView.class);

Services clickedItem = listOfServices.get(position);

serviceId = clickedItem.getServiceId();

sP.putExtra(CATEGORY_EXTRA,clickedItem.getServiceId());

Toast.makeText(getContext(),"serviceId:"+clickedItem.getServiceId(),Toast.LENGTH_LONG).
show();

// startActivity(sP);

//
Toast.makeText(getContext(),clickedItem.getServiceType(),Toast.LENGTH_LONG).show();
}

private void openDialog() {

final Dialog dialog = new Dialog(getContext());

LayoutInflater layoutInflater = this.getLayoutInflater();

View customDialog = layoutInflater.inflate(R.layout.dialog_customer_location,null);

radioGroup = customDialog.findViewById(R.id.rdgLocation);

knowLocation = customDialog.findViewById(R.id.chBxKnown);

differentLocation = customDialog.findViewById(R.id.chBxDifferent);

selectLocation = customDialog.findViewById(R.id.btnSelectLocation);

dialog.setContentView(customDialog);

dialog.show();

selectLocation.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

if(knowLocation.isChecked())

Intent sP = new Intent(getActivity(),ActivityServiceProviderView.class);

sP.putExtra(CATEGORY_EXTRA,serviceId);

startActivity(sP);

dialog.dismiss();

//Toast.makeText(getContext(),"you checked
known:"+serviceId,Toast.LENGTH_LONG).show();

}
else

Intent map = new Intent(getActivity(),Activity_gMap.class);

map.putExtra(CATEGORY_EXTRA,serviceId);

startActivity(map);

dialog.dismiss();

}) }}
Conclusion

Throughout the implementation of our project starting from writing a single line of code to fully working
interconnection of functions we have followed the basic naming standards and principles in each
programming languages we used. We have tested our code according to the rules and requirements of our
project and remarkable outcomes have been observed. The important issues to be discussed in every
system such as security issue and maintenance issue are also implemented in our project. So our system
has the ability to last long by using those basic parameters and improving and maintaining what we have
seen as weakness and a threat.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy