_var_

32
1 | Ioan Tuns-HNDCSD-PJ - 19/12/14 Assignment Front Cover Sheet PART 1 – To be completed by the student Student Name Ioan Tuns Student ID Number LON291101243 Module Name (e.g.: Business Environment) Programming in Java Course (e.g. HND Business ) HND in COMP & SD (Year 2, Semester 2) Assignment Title Student Record Keeping Systems Module Lecturer Rafiqul Islam Number of Words 2563 Assignment Due Date 18/12/14 Submission Date 19/12/14 First submission Resubmission (as per lecturer’s instruction) No cheating, dishonesty or plagiarism will be accepted from any learner who enrols for a qualification/course. All sources must be properly referenced using the Harvard Referencing System. Failure to properly reference any source constitutes plagiarism whereby the learner will be subject to disciplinary action, and will likely refer (fail) a unit. All assignments must be submitted in electronic format through http://moodle.lsbm.org.uk . This allows the College to check for plagiarism. PART 2 – Student declaration By submitting this work to LSBM, I confirm that I have read and understood the Dishonesty and Plagiarism Policy that is applicable to all assessments and assignments submitted by me. I also confirm further that the work submitted here is my own work, save for where indicated by proper referencing. Should I not abide by the policy and be found guilty of plagiarism by my course lecturer or any other LSBM or appointed staff member I shall be

Transcript of _var_

Page 1: _var_

1 | I o a n T u n s - H N D C S D - P J - 19/12/14

Assignment Front Cover SheetPART 1 – To be completed by the student

Student Name Ioan Tuns

Student ID Number LON291101243

Module Name(e.g.: Business Environment)

Programming in Java

Course (e.g. HND Business ) HND in COMP & SD (Year 2, Semester 2)

Assignment Title Student Record Keeping Systems

Module Lecturer Rafiqul Islam

Number of Words 2563

Assignment Due Date 18/12/14

Submission Date 19/12/14

First submission Resubmission (as per lecturer’s instruction)

No cheating, dishonesty or plagiarism will be accepted from any learner who enrols for a qualification/course. All sources must be properly referenced using the Harvard Referencing System. Failure to properly reference any source constitutes plagiarism whereby the learner will be subject to disciplinary action, and will likely refer (fail) a unit. All assignments must be submitted in electronic format through http://moodle.lsbm.org.uk. This allows the College to check for plagiarism.

PART 2 – Student declaration

By submitting this work to LSBM, I confirm that I have read and understood the Dishonesty and Plagiarism Policy that is applicable to all assessments and assignments submitted by me. I also confirm further that the work submitted here is my own work, save for where indicated by proper referencing. Should I not abide by the policy and be found guilty of plagiarism by my course lecturer or any other LSBM or appointed staff member I shall be bound by the decision of that lecturer and/or staff member as well as the terms of the Dishonesty and Plagiarism Policy.

Please save your document in the following format before submitting through Moodle:First name- Surname–Course–Unit–Assignment-date.docE.g.: Rubin Gurung-APDMS-BO-Assignment-3 Dec 09.doc

This page must be page 1 of your assignment. Start your work on page

Page 2: _var_

2 | I o a n T u n s - H N D C S D - P J - 19/12/14

Student Record Keeping Systems

Page 3: _var_

3 | I o a n T u n s - H N D C S D - P J - 19/12/14

Table of Contents0. Introduction..........................................................................................................5

1. Principles of programming in Java.......................................................................5

a) Principles, characteristics and features of programming in Java...................5

b) Critically evaluate the environmental flexibility of programming in Java........6

2. Solution design....................................................................................................7

a) Design solution..............................................................................................7

b) Components, data and file structures required to implement a given design.7

3. Implement Java solutions....................................................................................8

a) Implement a Java programming solutions based on a prepared design........8

b) Define relationships between objects to implement design requirements......8

c) Implement object behaviours using control structures to meet the design algorithms................................................................................................................8

d) Identify and implement opportunities for error handling and reporting...........9

e) Make effective use of an integrated development environment including code and screen templates.....................................................................................9

FootballClub.java.................................................................................................9

Person.java........................................................................................................12

Player.java.........................................................................................................13

Goalkeeper.java.................................................................................................14

4. Test and Document Java solutions....................................................................14

a) and b) Critically review and test a Java programming solution and analyse test results against expected results to identify discrepancies..............................14

Test case...........................................................................................................15

Debugging..........................................................................................................18

c) Evaluate independent feedback on a developed Java program solution and make recommendations for improvements............................................................18

d) Create user documentations for the development Java program solution.. .19

e) Create technical documentation for the support and maintenance of a Java program solution....................................................................................................22

5. Conclusion.........................................................................................................25

6. Bibliography.......................................................................................................26

Page 4: _var_

4 | I o a n T u n s - H N D C S D - P J - 19/12/14

Page 5: _var_

5 | I o a n T u n s - H N D C S D - P J - 19/12/14

0. Introduction

Java become faster one of the most used programing languages because facilitates implementation from desktop to server solution (Cadenhead, 2013).

This piece of work intends to present a structure of Java application, from working environments to the strong tools of error handling, debugging and cod documentation.

1. Principles of programming in Java

Java Environment

Java programing language is one of the newest programing language is one of the most versatile programing language, can be used in almost all kind of applications, from business use to entertainment, from servers and computers to mobile devices, and as well is free operating systems platform.

a) Principles, characteristics and features of programming in JavaIt is simple. Java is one of the newest programing languages with a mixed structure inheritance from C and C++. As well as provide an easy to write, readable and eye catching structure (Gosling, J. , Joy, B. and others, 2014).

It is an Object Oriented Program. Because of inheritance from C++, Java it is an OOP language. Provide a flexibility, modularity, clarity, and reusability through encapsulation, inheritance, polymorphism, association, and composition using specific Java classes and methods construction (Gosling, J. , Joy, B. and others,2014).

It is a distributed platform. “Java is the foundation for virtually every type of networked application (Java, 2014)”. Java can run in web browser, server or client side create versatile application in different fields (Gosling, J. , Joy, B. and others,2014).

It is interpreted, architecture-neutral and portable. Java it is an interpreted programing language because have to run in top of Java Virtual Machine (JVM). Java Virtual Machine transforms Java source-code to machine-code and runs straightaway. Because of this construction Java can runs on top of all kind of machines and architectures how long time on there can find a JVM (Gosling, J. , Joy,B. and others, 2014).

It is robust. Java runtime has a good of error and exception handling; it is way become of the most robust programing platform (Gosling, J. , Joy, B. and others,2014).

Page 6: _var_

6 | I o a n T u n s - H N D C S D - P J - 19/12/14

It is secure. JVM integrate provides a high level of security throw a lot of tools. One of this tools is called “sandbox” to block from execution untrusted code. Another one is security manager useful to block untrusted code from reading or writing on the local computer file system (Gosling, J. , Joy, B. and others, 2014).

It is performance and dynamic because of JVM which can run the code without to be recompiled; as well the code can be loaded on the fly (Gosling, J. , Joy, B. andothers, 2014)

b) Critically evaluate the environmental flexibility of programming in Java.

Ability to use English language on source code defines a programing language like high-level programing language, which is Java also. It is allows the programmer to create a grammatical English structure in his code.

Object oriented Programing (OOP) is one of the most spread programing principles over the world, method enhance the programmers to order the source code in a structural way, to create classes and objects, to facilitate data structure and operations, like a part of Java language syntax. Seeing that is a part of OOP family languages provide all features like encapsulation, aggregation, encapsulation, inheritance, polymorphism, association, and composition.

To can run on a computer, the source code has to be translated to a machine code. Usually to make this kind of translation have to use a compiler or an interpreter. Compilers transform all source code into machine-code file, and the machine-code file is runs.

Figure 1 - Interpreter - Compiler structure

An interpreter translates each read source-code statement into machine-code or virtual machine-code, and executes them straight away.

Figure 2 - Virtual machine structure

Page 7: _var_

7 | I o a n T u n s - H N D C S D - P J - 19/12/14

Advantages of Java are to run on top of virtual machine, Java Virtual Machine, to transform the source-code to java bytecode and run strait away. Because of this capability a Java application allows to run in different platforms fast and within low resource needs.

2. Solution design

A design of a software solution involves a graphical representation of customer requirements, like interactions and relations inside of required application. Also presents an object structures, file and data structure used on implementation.

a) Design solutionIn current implementation, based on customer demand, identified three related classes. These are person, player, and goalkeeper.

Figure 3 - ERD of Football Club

Person class handle general characteristic of a person, like first name, last name, date of birth, height, weight.

Player class store player characteristics and history, like season when he play, no of played games, and no of goals scored. It is an extension of person class to get all person details.

Goalkeeper is inherited from player to get al player and person details, and in addition store for a goalkeeper no of saved penalties.

b) Components, data and file structures required to implement a given design.

Source code is structured in 4 files, one for each class. Main class, FootballClub, runs from FootballClas.java file where perform all functions of application. This class performing operations like create the working file based on user input, input values of each parameter, display saved information from working file. Also perform menu structure, graphical output and error handling of input operations.

Person.java runs Person class inherited from FootballClub class like an extension. All functions described on ERD Football Club for this class are performs hear. As well as defines necessary variables, like FirstName, LastName, Dob of type String and height and weight of type int.

Page 8: _var_

8 | I o a n T u n s - H N D C S D - P J - 19/12/14

Other two classes, Player and Goalkeeper, from ERD Football Club run in two different files. Also presents inheritance, Player from Person and Goalkeeper from Player using extension syntax.

Also a working file is created, or open if exits. This is a .txt file where all input data are stored. Like operations in this file are performing open, writing and reading.

3. Implement Java solutions

a) Implement a Java programming solutions based on a prepared design.

Full details about implementation are presented in task 3.e) where displays all source code.

b) Define relationships between objects to implement design requirements.

All objects of this implementation are inherited in a structural way using extend statement. Top class is FootballClub to ensure all functions of application. Second one is Person used to store all details of a person like first name, last name, and date of bird, height, and weight. The next one on in inheritance chain is Player used to store other behaviour of a player like season, number of games and how many goals marks. Goalkeeper, inherited by Player, add for a player which is goalkeeper a function to store number of penalties that the goalkeeper has saved.

c) Implement object behaviours using control structures to meet the design algorithms.

For structure control has chosen to use an if statement, do-wile and switch.

If statement is used to check if the working directory has created.

Do-while is used to return back when a operation is done if the exit(), value 4, function is not called to finish the program, case 4 of our switch.

Page 9: _var_

9 | I o a n T u n s - H N D C S D - P J - 19/12/14

Switch is used to create the menu of application. Each case performs different actions. Full details are presented in tack 3.e)

While statement is used to read working file on switch case 3.

d) Identify and implement opportunities for error handling and reporting.

For error handling and reporting has used try-catch using IOException Java function to store and display the error. Implementation is done like bellow. Full range of error handling implementation are presented in task 3.e)

Page 10: _var_

10 | I o a n T u n s - H N D C S D - P J - 19/12/14

e) Make effective use of an integrated development environment including code and screen templates

FootballClub.java

Page 11: _var_

11 | I o a n T u n s - H N D C S D - P J - 19/12/14

Page 12: _var_

12 | I o a n T u n s - H N D C S D - P J - 19/12/14

Page 13: _var_

13 | I o a n T u n s - H N D C S D - P J - 19/12/14

Page 14: _var_

14 | I o a n T u n s - H N D C S D - P J - 19/12/14

Person.java

Page 15: _var_

15 | I o a n T u n s - H N D C S D - P J - 19/12/14

Player.java

Page 16: _var_

16 | I o a n T u n s - H N D C S D - P J - 19/12/14

Goalkeeper.java

4. Test and Document Java solutions

For testing purpose an investigation is carry on to prove the software meet functional and quality requirement. As well as a good documentation is prepared to allow the users to understand all functions provided by de application and an easy an fast maintenance and further development to be on place.

a) and b) Critically review and test a Java programming solution and analyse test results against expected results to identify discrepancies.

Software testing is carrying on in meaning of identifying all software bugs and if all functional requirements are in place. The stakeholders have to know at all-time what is going on and how some problems can solved them out.

A software testing can be done in using various methods, like white-box and black-box testing, or visual testing. All this testing does can be done using different approach. One of this approach is call static testing where a reviews, walkthroughs, or inspections are involves. The other one is called dynamic testing where uses test cases (Hetzel, 1988).

Page 17: _var_

17 | I o a n T u n s - H N D C S D - P J - 19/12/14

Test caseEach test has to provide an output, if the software meet or not meet the requirement. This report can include also recommendations of improvements.

Case Test Case Expected results Return results1 Insert a correct path file Move to next step

without errorPASS

2 Insert a wrong path file Return an exception error message and asking to insert correct path file

PASS

3 Insert character like path file Return an exception error message asking to insert correct path file

FAIL, application move ahead with a wrong working file.

Page 18: _var_

18 | I o a n T u n s - H N D C S D - P J - 19/12/14

Improvements: Improve error handling implementation to return an error message and ask for a correct path.

4 Insert character on all fields at player insertion.

Expect return an error message at DoB, Height, Weight, Games Played and Goal Scored fields

FAILDAccesept on DoB field difrent data type wirhout returning errorAt the Height field return unexpected error and stop execution

Improvements For DoB field have to create a validation form to not accept other input then date format.Revise try-catch implementation on menu section to return an error if inappropriate data type are inserted

5 Insert appropriate data in each field, like first name and last

Have to record all details in working file,

PASS

Page 19: _var_

19 | I o a n T u n s - H N D C S D - P J - 19/12/14

name string type, DoB and season played data type, and height, weight, games played and goals scored int type

and display a massage “Player FirstName LastName added successfully!” and return to main menu

6 Insert integer type into first name and last name fields

Return a massage about not correct name format

FAIL, application doesn’t return an error and accept to insert a name with an integer value.

Improvements: Create a form validation for fields First Name and Last

Page 20: _var_

20 | I o a n T u n s - H N D C S D - P J - 19/12/14

Name to not accepts a single character or an integer like first name or last name

7 List all team members from working file.

Display on the screen all records from working file

PASS

DebuggingDebugging process has done using tools provided by IDE, in our case NetBeans IDE.

No bugs found.

c) Evaluate independent feedback on a developed Java program solution and make recommendations for improvements.

Feedback from Ciprian Hincu:

Page 21: _var_

21 | I o a n T u n s - H N D C S D - P J - 19/12/14

The program that Ioan developed marks all the requirements that have been set up in the scenario. It seems to perform relatively well as long as the input given is not different than the data type assigned to the specific variable. One issue that I can spot while viewing the code is that the commenting for different sections aren`t accurate enough for me as a new programmer working with the same code to fully understand Ion`s logic behind the program itself. I believe that a bit more instructions should have been added along the code. One very important thing that wasn`t documented within the program code was the file path for the created text file where the program saves all its information. One separate section with instructions should have been created to let other persons know that we must check and modify the file path according to our own Operating System.

A strong suggestion would be to try and compile the program into an .exe application to make it easier for non-programmers to run this application. Another aspect would be to try and upgrade the program from the console/command line view to a more interactive and easy to use interface; for that changes I recommend JavaFX library or the JAVA SWING framework. At this point even if the program might run correctly in the best case scenarios, it sure lacks some features that make it easier to understand, use or altered.

However for the sake of demonstrating beginner Java skills, ION did a good work when going from theory to practice?

d) Create user documentations for the development Java program solution.

Each part of the application has a clear statement with on the fly helps and instructions.

Each input have to be followed by enter to be validate.

Setup working directory:

- Start application using NetBeans IDE, go to FootballClub like bellow

- Press run button at the top

Page 22: _var_

22 | I o a n T u n s - H N D C S D - P J - 19/12/14

- Is required to tape working directory in following format “C:\filename.txt” - If a wrong path is provided is required to insert a correct one.

- Main Menu 1. Add Player – perform input of player details2. Add Goalkeeper – perform input of goalkeeper details3. View Team List – display team list4. Exit – exit from application

If any other value for menu are inserted a massage is display and ask you to select the correct menu.

Page 23: _var_

23 | I o a n T u n s - H N D C S D - P J - 19/12/14

- 1. Add player

Input 1 and press enter and start to ask you about inserting player details line by line

When all details are inserted, details are saved in working directory and a massage is display.

- Add GoalkeeperInput 2 and press enter and start to ask you about inserting goalkeeper details line by line

Page 24: _var_

24 | I o a n T u n s - H N D C S D - P J - 19/12/14

When all details are inserted, details are saved in working directory and a massage is display

- 3 View Team ListInput 3 and press enter – all saved details are displayed.

- 4 – Exit

Page 25: _var_

25 | I o a n T u n s - H N D C S D - P J - 19/12/14

Input 4 and press enter – application is closed

e) Create technical documentation for the support and maintenance of a Java program solution.

In general, the documentation is performed on a set of templates predefined. However, with the development of the Web, a number of increasingly great articles documentation can be found on wikis, specialized web pages, and blogs, especially those intended for developers. Forms and MSDN Library documentation, Documentation Java, GNU libc are available online.

Forms code documentation; interfaces include man pages, web pages, tutorials, LaTeX documents, references etc. In general, most forms of documentation used provides a web interface (MSDN library, man pages, info pages, reference libc, Java API, Python Standard Library, PHP) to facilitate access and read them.

A possible form of code documentation, successfully used Java API documentation is automatically generated from sources using Javadoc tool. Using a special style commenting sources that do not affect readability code, applications automatically generate documentation obtained in various formats, the most common being HTML, information about using the / classes / methods exposed

Technical documentation has don by using in line comment like

Also because is a Java development has use Javadoc, is the Java API Documentation Generator.

FootballClub Class documentation

Page 26: _var_

26 | I o a n T u n s - H N D C S D - P J - 19/12/14

Goalkeeper Class

Page 27: _var_

27 | I o a n T u n s - H N D C S D - P J - 19/12/14

Using Javadoc all related operations to documented functions and objects are documented and present a clear view about what is going on.

Like create an instance of Goalkeeper show information about Goalkeeper Class

Or instance of setFname documented in FootballClub Class.

5. Conclusion

Java is one of the most versatile programing languages because is platform independent, is object oriented and provide a clear structure. As well as provide strong security and debugging and documenting tools (Cadenhead, 2013).

.

Page 28: _var_

28 | I o a n T u n s - H N D C S D - P J - 19/12/14

6. Bibliography

Bennett, S. and McRobb, S. and Farmer, R., n.d. Object-Oriented Systems Analysis and Desing using UML. 3rd ed. s.l.:McGraw Hill.

Bloch, J., 2012. Effective Java. 2nd Edition ed. s.l.:Pearson Higher Education .

Cadenhead, R., 2013. Java in 21 Dayes. 6th ed. s.l.:Pearson Education.

Drake, Peter, 2013. Data Structures and Algorithms in Java. s.l.: Pearson.

Fortier, P. J. and Michel, H. E., 2003. Computer Systems Performance Evaluation and Prediction. Burlington: Digital Press.

Gosling, J. , Joy, B. and others, 2014. The Java® Language Specification. [Online] Available at: http://docs.oracle.com/javase/specs/jls/se8/html/index.html[Accessed 02 12 2014].

Hetzel, B., 1988. The Complete Guide to Software Testing. 2nd ed. s.l.:John Wiley&Sons Inc..

Java, 2014. New to Java Programming Center. [Online] Available at: http://www.oracle.com/technetwork/topics/newtojava/overview/index.html[Accessed 04 12 2014].

Myers,G. J. and Standler, C. and Badgett, T., 2012. The art of software testing. 3-th ed. New Jersey: Jhone Wiley& Sons Inc.