Hello World - MVP Mini Project (Sicolo)

Page 1

Sicolo

SCHOOL OF CODE

HELLO WORLD

HELLO WORLD AN MVP MINI PROJECT MANIFEST

Credits

Author: Sosthene Grosset-Janin (sgrosset@gmail.com)

LinkedIn: https://www.linkedin.com/in/sgrosset/

GitHub: https://github.com/sicolo-eoex

Web:

Date: February 2023

Version: 1.0.a

Table of Contents

1- Summary

Abstract

Executive Summary

Objectives, Problems & Solutions

Stakeholders & Collaborators

Target Audience

Duration

Knowledge Requirements

2- Ideation

Screenshot

Scope

Pre-Requisites

Constraints

3- Design

Wireframe

Mockups

Storyboard

4- Architecture

Data Model

Schema

ERD – Entity Relationship Diagram

Class Diagram

Metadata

5- Build

Implementation

Testing

Compilation

Documentation

Jar Packaging

1- Summary

Abstract

Did you know that there is a long standing tradition among computer programmers and IT professionals overall which dictates that the very first computer program that we write MUST be called “Hello World. Therefore, in the spirit of this tradition we have chosen this program as the first one in our library of computer programming projects.

Executive Summary

Did you know that there is a long standing tradition among computer programmers and IT professionals overall which dictates that the very first computer program that we write MUST be called “Hello World. Therefore, in the spirit of this tradition we have chosen this program as the first one in our library of computer programming projects.

Objectives, Problems & Solutions

We plan to write a simple computer program in the Java programmign language. This program will be made of a main class (Main.java), containing a “main” method, and a “loader class” (HelloWorld.java) containing methods that implement the display of the message “Hello World!”

Stakeholders & Collaborators

The only potential stakeholder of this program is a standard computer user with no prior knowledge nor expertise in computer programming.

Target Audience

This project is aimed at beginners in computer programming, but can also serve a learning support for software developers with some level of experience.

Duration: 8 hours

Knowledge Requirements

Computer usage. Compilation in Java. Terminal command line (CLI) in your respective operating system.

2- Ideation

Scope: not required for this project

Pre-Requisites

Personal Computer Memory: 16GB RAM / Storage: 500 GB / OS: Linux (Ubuntu) recommend ed

Recording device Phone or other

https:// ubuntu.com/ tutorials/ create-ausb-stick-onSoftware

https:// ubuntu.com/ tutorials/ create-ausb-stick-

Name Description Source URL Installation Script Status
N/A N/A Hardware
Hardware
Ubuntu Operating System (Recommen ded)

ubuntu#1overview onwindows#1overview

https:// xmind.app/

BlueJ IDE (text editor for writing code) Software

https:// rb.gy/wiwd4j

Chrome Internet / Web browser N/A Software

Javac Java Compiler Installation

JDBC Java Database connection driver Hardware

Installation Hardware

Google Drive Online folder for project code storage N/A Online Tools

https:// www.google. com/drive/

Google Docs Online Text Editor https:// www.google. com/docs/ about/

Google Spreadsheet Online Spreadsheet https:// www.google. com/ sheets/

Name Description Source URL Installation Script Status
Xmind Mind Mapping Software N/A Software
https:// www.bluej.or g/
Hardware
Installation
MySQL Database Server Download
N/A Online Tools
N/A Online Tools

Constraints: Keep this project simple with low complexity

3- Design

(sample code: HelloWorld.java)

Mockups: not applicable for this project

Storyboard: not applicable for this project

Name Description Source URL Installation Script Status about/ Google Presentation Online Presentation https:// www.google. com/slides/ about/ N/A Online Tools Diagrams.net Online Drawing / Sketching tool https:// app.diagram s.net/ https:// www.diagra ms.net/ Online Tools
Wireframe

4- Architecture

Data Model

CLASS

public Main.java

public HelloWorld

METHOD

public static void main(String[] args) - Main.java

public HelloWorld()

println()

VARIABLES

String message = “Hello World!”;

Schema: not applicable for this project

- HelloWorld.java

- std: System.out

ERD – Entity Relationship Diagram: not applicable for this project

Class Diagram

(sample code: HelloWorld.java)

Metadata: not applicable for this project

5-Build

Flowchart: The logical stating point of any computer program implementation is the creation of a “Flowchart”.

Definition: Flowchart is a graphical representation of an algorithm. Programmers often use it as a program-planning tool to solve a problem. It makes use of symbols which are connected among them to indicate the flow of information and processing.

(flowchart: Hello World)

Flowchart Elements:

(flowchart: elements)

Source Code:

(code: Main.java)

(code: HelloWorld.java)

Code Errors: Errors end up in the programs that we write. Sometimes the errors are not serious and cause headache mostly to users of the program. Occasionally, however, mistakes can lead to very serious consequences. In any case, it's certain that a person learning to program makes many mistakes.

You should never be afraid of or avoid making mistakes since that is the best way to learn. For this reason, try to break the program that you're working on from time to time to investigate error messages, and to see if those messages tell you something about the error(s) you've made.

Checklist for Troubleshooting:

If your code doesn't work and you don't know where the error is, these steps will help you get started.

1.Indent your code properly and find out if there are any missing parentheses.

2.Verify that the variables used are correctly named.

3.Test the program flow with different inputs and find out the sort of input that causes the program to not work as desired. If you received an error in the tests, the tests may also indicate the input used.

4.Add print commands to the program in which you print out the values of the variables used at various stages of the program's execution.

5.Verify that all variables you are using are initialized. If they aren't, a NullPointerException error will occur.

6.If your program causes an exception, you should definitely pay attention to the stack trace associated with the exception, which is the list of method calls that resulted in the situation that caused the exception.

7.Learn how to use the debugger.

Testing

NOTE: Manually testing the program is often laborious.

Unit Testing:

Testing larger programs in this way is challenging. One solution to this is unit testing, where small parts of the program are tested in isolation. Unit testing refers to the testing of individual components in the source code, such as classes and their provided methods. The writing of tests reveals whether each class and method observes or deviates from the guideline of each method and class having a single, clear responsibility. The more responsibility the method has, the more complex the test. If a large application is written in a single method, writing tests for it becomes very challenging, if not impossible. Similarly, if the application is broken into clear classes and methods, then writing tests is straightforward.

Types of unit testing:

There are two ways to perform unit testing:

1) Manual Testing

1) manual testing

2) automated testing.

If you execute the test cases manually without any tool support, it is known as manual testing. It is time consuming and less reliable.

2) Automated Testing

If you execute the test cases by tool support, it is known as automated testing. It is fast and more reliable.

How Do Unit Tests Work:

Unit tests work by isolating code functions and/or procedures in a source file for the purpose of individually testing these small units of code for safety, security, and robustness. To isolate code functions or units of code, developers and testers perform stubbing. A stub may simulate the behavior of existing code or be a temporary substitute for yet-to-be-developed code. Users can monitor stub execution to check against certain expectations, such as the number of calls to a given stub or the sequence of stub calls. Users must define expectations inside test cases, and then verify them after the test case execution is finished.

The functions or units generally include input of various types (char, integer, pointers) and the values may differ for each upon the call to the unit. To test the code unit, users manipulate its input values to help ensure correct functional behavior upon valid input values. However, the unit must ensure robustness, therefore the input of values outside expected ranges, including null values, should be used. This flushes out defects like memory access violations, divide-byzero scenarios, stack overflow conditions, and other safety, security, and reliability errors.

As unit tests are executed, output values may be collected, and inspected for correctness, and reports stored for audit and or compliance purposes. Many development teams also integrate structural code coverage to expose code that has not been tested. Knowing that each individual unit of code has been tested and is sound eliminates risk and helps ensure the delivery of a quality application. For safety-critical applications, 100% code coverage is commonly performed.

Advantages of Unit Testing:

Identifies quality issues: safety, security, and reliability defects.

Ensures functional requirements are being satisfied.

Helps to satisfy structural code coverage.

Satisfies compliance requirements.

Unit tests are re-used to flush out code regressions.

Simplifies the debugging process.

Provides application metrics on health and hot spots. Disadvantages of Unit Testing:

Unit testing does not catch all application flaws.

Manual unit testing is time-consuming and labor-intensive.

Unit testing is not very suitable for GUI testing.

Managing hundreds of unit tests is difficult without automation.

Test-Driven Development:

Test-driven development is a software development process that's based on constructing a piece of software in small iterations. In test-driven software development, the first thing a programmer always does is write an automatically-executable test, which tests a single piece of the computer program.

The test will not pass because the functionality that satisfies the test, i.e., the part of the computer program to be examined, is missing. Once the test has been written, functionality that meets the test requirements is added to the program. The tests are then run again. If all tests pass, a new test is added, or alternatively, if the tests fail, the already-written program is corrected. If necessary, the internal structure of the program will be corrected or refactored, so that the functionality of the program remains the same, but the structure becomes clearer. Test-driven software development consists of five steps that are repeated until the functionality of the program is complete.

1.Write a test. The programmer decides which program functionality to test and writes a test for it.

2.Run the tests and check if the tests pass. When a new test is written, the tests are run. If the test passes, the test is most likely erroneous and should be corrected - the test should only test functionality that hasn't yet been implemented.

3.Write the functionality that meets the test's requirements. The programmer implements functionality that only meets the test requirements. Note: this doesn't do things that the test does not require - functionality is only added in small increments.

4.Perform the tests. If the tests fail, there is likely to be an error in the functionality written. Correct the functionality - or, if there is no error in the functionality, fix the latest test that was performed.

5.Repair the internal structure of the program. As the size of the program increases, its internal structure is adjusted as needed. Methods that are too long are broken down into multiple parts and classes representing concepts are isolated. The tests are not modified, but are instead used to verify the correctness of the changes made to the program's internal structure - if a change in the program structure changes the functionality of the program, the tests will produce a warning and the programmer can remedy the situation.

The previous figure depicts unit testing alongside other software testing levels, wherein each level has its own scope:

 Unit testing tests each software module.

 Integration testing tests the combined modules according to system design documents and functional requirements.

 Functional testing tests a program’s desired functionality based on requirement analysis documents and the user manual (i.e. ensuring the expected output for a given input). This is sometimes divided into system testing and acceptance testing.

 Black box testing tests software behavior without knowing the implementation details of a software module. These tests are derived from the software specification document.

 White box testing tests the actual implementation of a software module., wherein the inner architecture of the program is known to the tester. These tests give us implementation insights to develop more comprehensive tests.

For unit testing, white box testing is usually the most suitable option, particularly when our modules are smaller and their code is easier to comprehend. On the other hand, black box testing is a good option for later stages of a project, when modules have been integrated to create a complex software.

Unit testing, where any given test covers the smallest unit of a program (a function or procedure). It may or may not take some input parameters and may or may not return some values.

 Integration testing, where individual units are tested together to check whether all the units interact with each other as expected.

Test planning:

A test plan dictates a unit test’s complexity and design. Because we have limited time and budget for any development project, it’s not always possible to exhaustively unit test a project. Taking this into consideration, a test plan will determine which resources will be allocated to unit testing.

Test coverage:

It is a metric to determine how thoroughly we’ve unit tested our software. As a general rule, we want to maximize test coverage as much as possible.

Test coverage can be further classified as follows:

 Function coverage: The percentage of functions which have been tested

 Statement coverage: The percentage of statements that have been tested. Sometimes, it includes all the statements that have been executed at least once during the testing.

 Path coverage: The percentage of paths that have been tested. A software may have multiple paths (or branches) taken by it based on conditions, such as, user’s input, environment sensing, and other events.

Unit testing frameworks:

A unit testing framework is software that enables us to quickly code unit tests and automate their execution. In the event that a test fails, frameworks can save the results or throw an assertion.

There are dozens of unit testing frameworks available for various programming languages. Some popular unit testing frameworks include Cunit, Moq, Cucumber, Selenium, Embunit, Sass True, HtmlUnit, and JUnit (one of the most widely used open source frameworks for the Java programming language).

We can save a great amount of time and resources with unit testing frameworks, which include the following features:

 Test suite: A set of test cases that are grouped for test execution purposes, which allows us to aggregate multiple similar unit tests.

 Test runner: A component which automates execution of a series of test cases and returns the test result to the user.

 Test fixture: A predefined state or fixed environment in which we run tests, ensuring that our tests are repeatable across multiple test runs.

Arrange, Act, and Assert (AAA)

The AAA protocol is a recommended approach for structuring unit tests. As a unit testing best practice, it improves your test’s readability by giving it a logical flow. AAA is sometimes referred to as the “Given/When/Then” protocol.

You can use the AAA protocol to structure your unit tests with the following steps:

 Arrange: Arrange the setup and initialization for the test

 Act: Act on the unit for the given test

 Assert: Assert or verify the outcome

Testing our application:

(Unti Test code: HelloWorld.java)

Testing our application:

(Unit Test code: JUnitHelloWorldTest.java)

Compilation

(BASH script: javac compilation)

Documentation

(BASH script: javadocs compilation)

(Javadocs: Package view)

(Javadocs: Class view)

(Javadocs: Class Hierarchy Tree view)

(Javadocs: Class Index view)

(Javadocs: Overview)

Jar Packaging

(BASH script: executable jar package file compilation)
for your participation !
Thank you

Sicolo

SCHOOL OF CODE

HELLO WORLD

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.