Unit 1 Programming - Assignment 3 Theory Content and guidance
Assignment 3 Overview Your aim is to create a fully working, secure application that has been developed using an IDE and adheres to coding standards. Your code should contain an algorithm and some sort of user input either through the command line, swing or Java FX. The document portfolio should include: Evidence of how the IDE was used to manage the development of your code. An evaluation of developing applications using an IDE versus developing an application without using an IDE. An evaluation of the debugging process in the IDE used and how it helped with development. An evaluation of coding standards and the benefits to organisations of using them.
You will produce 5 documents/files: Stage 1 – Development Document - Evidence of how the IDE was used to manage the development of your code. Stage 2 – Report (IDE Evaluation) - An evaluation of developing applications using an IDE versus developing an application without using an IDE. Stage 3 – Report (Debugging Evaluation) - An evaluation of the debugging process in the IDE used and how it helped with development. Stage 4 – Report (Evaluation Report) including fully commented source code - An evaluation of coding standards and the benefits to organisations of using them. An installable and executable version of your application You are required to make use of appropriate structure, including headings, paragraphs, subsections and illustrations as appropriate, and all work must be supported with research and referenced using the Harvard referencing system.
Debugging The process of detecting and removing of existing and potential errors (also known as 'bugs') in a software code that can cause it to behave unexpectedly or crash. To prevent incorrect operation of a software or system, debugging is used to find and resolve bugs or defects.
Debugging Process - Tracing A technique of following (Tracing) your code line to line as the computer would. Working out exactly the values of variables throughout the program flow line by line. Programmers do this to make sure the program makes sense and to identify errors in the code. It can also be done to help understand another programmers code.
Debugging Process – Simple Tracing Example String title =“HNC Computing"; int number = 370; boolean result = true; number = number - 5; System.out.println( "Course is " + title); System.out.println( "Days are " + number); System.out.println( "Answer is " + result) result = false; System.out.println( "Answer is now" + result); When tracing you’d go through the code making a note of all variables. As you go line by line you would update the value of the variable. This could be done on paper. An example for this simple program is below: Char: J String title: HNC Computing int number = 370 365 boolean result: true false
Debugging Process – Breakpoints A line of code where you want to "pause" the execution of a program. This suspends the program allowing you to examine the code at this point of execution. Before starting the debugger, you need to set at least one breakpoint to suspend the execution inside the program.
Debugging Process – Watch Lists Allows you to "watch" the value of a variable. For example, if you have a variable named "x", you can type x inside the watch window and watch the value as you go from breakpoint to breakpoint. To add expressions to a watch list in NetBeans: 1. Click on the "Watches" tab at the bottom. 2. Type in a variable where it says <Enter new watch> to watch the name variable and press the enter button.
Consider possible security concerns and how these could be solved. Limit access to your classes, methods, and variables Every class, method, and variable that is not private provides a potential entry point for an attacker. By default, everything should be private. Make something nonprivate only with good reason, and document that reason. Make everything final (unless there's a good reason not to) If a class or method isn't final, an attacker could try to extend it in a dangerous and unforeseen way. More detailed information from Oracle: https://www.oracle.com/technetwork/java/seccodeguide- 139067.html
What is a coding standard? Why use them? Also known as coding conventions or syntax conventions What is a coding standard? Why use them? A set of guidelines, best practices, programming styles and conventions that developers adhere to when writing source code for a project. All big software companies have them. Coding standards are all about creating: Robust – Error-free and efficient. Readable – Easily read and understood. Rectifiable – Properly documented. Reusable – Capable of being used again. Keep in mind that coding standards can vary between company's. Have a look at “Google style” coding standards here: https://google.github.io/styleguide/javaguide.html Coding standards are NOT enforced by the compiler
So It is simply a set of rules and guidelines for the formatting of source code. This includes: Naming Conventions File Naming and Organization Formatting and Indentation Comments and Documentation Classes, Functions and Interfaces Pointer and Reference Usage Testing An example would be the use of two different styles of CamelCase: UpperCamelCase lowerCamelCase This standard could be different between teams needing to be refactored.
Refactoring The method of changing source code to meet a teams coding standard Used to improve readability or improve its structure. Any change that does not alter the behavior of the software can be considered refactoring. Common refactoring involves: Changing variable names, methods names, moving methods or classes Splitting large methods into smaller ones.
Benefits of coding standards These include: Readability, maintainability and compatibility. Any member of the organization will understand the coding standard. Therefore coders can interchange without to much trouble understanding others code. Improves: Team coder Integration Maintenance Easier Problem Solving Minimises the need for excessive communication Lowers man hours for the organisation
Creating a executable file in netbeans Right-click on the Project name. Select Properties. Click Packaging. Check Build JAR after Compiling. Check Compress JAR File. Click OK to accept changes. Right-click on a Project name. Select Build or Clean and Build. Locate .jar file in “dist” folder of project
Learning Outcomes and Assessment Criteria Pass Merit Distinction LO3 Implement basic algorithms in code using an IDE P3 Write a program that implements an algorithm using an IDE. M3 Use the IDE to manage the development process of the program. D3 Evaluate the use of an IDE for development of applications contrasted with not using an IDE. LO4 Determine the debugging process and explain the importance of a coding standard P4 Explain the debugging process and explain the debugging facilities available in the IDE. P5 Outline the coding standard you have used in your code. M4 Evaluate how the debugging process can be used to help develop more secure, robust applications. D4 Critically evaluate why a coding standard is necessary in a team as well as for the individual.
1 of 3 - Your assignment should include: Stage 1 – Development Document P3 Create a simple application which implements basic algorithms, using Java and suitable IDE. Consider possible security concerns and how these could be solved. Documents the production of your code. Stage 2 – Report (IDE Evaluation) M3 Explain how you used the IDE to efficiently create your program D3 An evaluation of developing applications using an IDE versus developing an application without using an IDE.
2 of 3 - Your assignment should include: Stage 3 – Report (Debugging Evaluation) An evaluation of the debugging process in the IDE used and how it helped with development. P4 Part 1 Discuss how the debugging process can be used to help developers fix vulnerabilities, defects and bugs in their code. With reference to watch lists, breakpoints and tracing P4 Part 2 Produce documentation of the debugging process in the IDE. Include screenshots of errors and explain how you have solved them. M4 Evaluate how the debugging process can be used to help develop more secure, robust applications.
3 of 3 - Your assignment should include: Stage 4 – Report (Evaluation Report) including fully commented source code P5 Discuss what a coding standard is and its benefits when writing code. Outline the coding standard you have used. D4 Critically evaluate why a coding standard is necessary in a team as well as for the individual. Wrap up with a short evaluative conclusion summing up the overall process, what went well and what could be improved. Stage 5 – EXE file of complete program Create an EXE in NetBeans using the tutorial earlier in this PowerPoint