Programming and Design Principles
Introduction
IT Rule & Regulations
- From Student Handbook on www.csn.ie
File Management
- Create a folder for each component (files and folders)
- Backup o Google Drive, iCloud, Dropbox, etc
Assessment
- Discuss from spec
- SD1 20% Brief: PDP Assessment Brief SD1 Test Data: PDP_SD1_Test_Data
- Sample Project Plan Project – Skills Demo Plan
Network Logon accounts
- Available from Course Director (UN: student, PW: letmein)
Component Descriptor NEW UPDATED component to be uploaded
Resources
- https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op1.html
- Free eBooks – https://goalkicker.com/
Learning Outcomes
- Demonstrate an understanding of the historical development of computer programming.
- Demonstrate an understanding of algorithms and their applications in solving real-world problems.
- Differentiate between programming languages by identifying their distinguishing characteristics.
- Develop an understanding of the procedural syntax of a modern programming language to include storage (variables and data types), expressions, statements, input/output, reserved keywords and operators.
- Explain the sequential nature of problem solving and how it relates to the science of computer programming.
- Summarise a broad range of structured programming and design concepts to include pseudo-code, storage and control structures (selection and iteration).
- Develop a range of documented computer programs to solve a variety of familiar and unfamiliar specified problems.
- Utilise a selection of modularisation concepts such as functions, procedures, variable scope and parameter passing.
- Interpret compiler and linker messages to the extent that an appropriate course of action can be taken to remedy any reported errors.
- Devise a testing process using structured walk-throughs and debugging tools.
- Comply with an accepted set of coding standards in their use of comments, indentation and variable naming.
- Work as part of a team to design, develop, release and review multiple versions of a multi modular program over an extended period of time
Java
- Installation of JDK (Java Development Kit) from Oracle website and Installation of Java runtime environment (IntelliJ IDEA, Eclipse or NetBeans);
- Installing Java JDK on Window 10 machine – Video
- Java Syntax – https://en.wikipedia.org/wiki/Java_syntax
- Java Core – Core Java refers to a collection of libraries rather than just the programming language. It’s the purest form of Java primarily used for development of general desktop applications. Simply speaking, it refers to the subset of Java SE technologies which consists of both general purpose API’s and special purpose API’s.
- Java Collections – The Java collections framework is a set of classes and interfaces that implement commonly reusable collection data structures. Although referred to as a framework, it works in a manner of a library. The collections framework provides both interfaces that define various collections and classes that implement them.
- Java Frameworks and Libraries – Frameworks and libraries are both code written by someone else that helps you perform some common tasks in a less verbose way. A framework inverts the control of the program. It tells the developer what they need. A library doesn’t. The programmer calls the library where and when they need it. Read more
- APIs – The full form of API is Application Programming Interface. It is a document which gives you the list of all the packages, classes, and interfaces, along with their fields and methods. Using these API’s, the programmer can know how to use the methods, fields, classes, interfaces provided by Java libraries. API examples – Google Maps API: Google Maps APIs lets developers embed Google Maps on webpages using a JavaScript or Flash interface. YouTube APIs: YouTube API: Google’s APIs lets developers integrate YouTube videos and functionality into websites or applications. See www.rapidapi.com
Class notes – Java(identifiers/variables/operates/conditions/etc – Java – Book of notes
Section 1: History of programming – Learning outcomes 1 and 3
Explain the historical development of computer programming languages and discuss the need for
different languages and their distinguishing features.
• Define a programming language. 0 Definition of a computer programming language
• Explain the historical development and evolution of programming languages. 1 History of programming languages
• Explain how programming languages differ from one another and the reasons for different programming languages. 2 Differences between programming languages
• Explain different programming paradigms, for example, procedural, functional, object oriented, scripting and logic. 3 Programming Paradigms
• Explain syntax and the need to adhere to the syntax of a programming language. 4 Syntax
• Outline the distinguishing characteristics of languages. – http://dafoster.net/articles/2013/01/29/unique-features-of-various-programming-languages/
o Outline what they have in common e.g. strict syntax rules, data storage, input statements, output statements, branching, looping.
o Outline their differences e.g. different syntax, different structures, different focus. – 10-Class-Notes
• Explain the different generations of programming languages.
• Explain machine code. – Machine Code
• Explain low level programming, assembly language and an assembler. – Low Level Programming
• Explain high level languages, compilers, interpreters and translators. – High Level Languages – Compilers – Interpreters – Translators
Class Exercises – Write Java code
- 0 Language Basics
- 1 Exercise 1
- 2 Exercise 2 – using \n for blank line
- 3 Exercise Input from Java Console
- Difference between Bufferedreader and Scanner class
- Output – Writing to a text file in Java
- Java Prog – Math Operators
- Write the java code which inputs a weekly net pay and amount spent on 4 items, calculates amount remaining and outputs to screen.
- Java Prog – Volume of Cone – Write the java code to 1 Calculate the volume of cylinder, 2 Calculate volume of a rectangular room.
- Java-Exercise-Real-Roots
- Odd_or_Even_Number – Get class to work in pairs – using paper how would you determine if an inputted number is odd or even.
- Pos_or_Neg_Num – Determine if an inputted number is positive or negative.
- Random_Number_Generator – Random number generator
Section 2: Algorithms and pseudocode – Learning outcomes 2, 5 and 6 20-Class-Notes – Limit_Summing_Series_Prog
Enable the user to develop an algorithm and to use pseudcode to design a solution to a problem.
• Explain the sequential nature of problem solving.
• Outline the steps that should be followed when writing a program i.e. design, code and testing.
• Explain how to construct an algorithm. – 21-Program_Algorithms
o Explain different types of data storage and the range of data that can be stored for each data type.
o Explain the importance of using pseudocode.
o Demonstrate pseudocode examples for basic programming problems.
o Assist the learner in developing good and consistent pseudocode style.
• Explain the importance of developing a comprehensive set of test data to test a program.
Section 3: Basic programming concepts
Learning outcomes 4, 6, 7 and 9
Understand the core principles involved in designing a program. Introduce the learner to the basic concepts involved in programming, including storage, input, output, reserved keywords and mathematical operators. Facilitate the user in creating and debugging programs that use these concepts. Java Operators 1
Java IO (input/output) http://tutorials.jenkov.com/java-io/index.html
• Familiarise the learner with the structure and basic syntax of a program.
• Explain the sequential nature of program execution.
• Explain reserved keywords to the learner.
• Explain the syntax to output text in a program.
• Create a program that produces simple output e.g. “Hello World”.
• Examine the numeric, character and string data types available in a chosen programming language. For each data type, identify the range of data that it can store and the amount of RAM that it requires.
• Explain the syntax of variable declaration.
• Explain syntax
• Explain the different types of loops available in the chosen programming language and present the syntax of each type of iterative loop.
• Develop programs that demonstrate each type of iterative loop.
Notes
- Looping in Java
- Loop_Exercise_Multiplication_Tables
- Main_Menu_While_Loop_Switch
- Nested For Loops
- For Loop – increments greater than 1 – Exercise Solution: Solution
- For_Loop_with_Specified_Increments
- Inputs and Ranges Sample: Inputs and Ranges – Solution
- Formatting output: Printf and format methods – Printf – Nested Ifs – For Loop – Date – Printf_PrintingIn_Columns
- Arrays
- ArraysExample2
- Array_of_Random_Numbers
- Input_Ages_Calculate_Mean
- Code: MeanVarianceStandardDeviationusing Arrays Excel: MeanStandardDeviationVariance
Section 4: Branching and iteration – Learning Outcomes 6 and 7
Using a chosen programming language, introduce the learner to branching and iteration by creating and debugging programs to include the following:
• List and explain the relational operators available in the chosen programming language and their precedence. – Relational Operators
• List and explain Boolean operators. – Boolean Operators
• Equip the user with the precedence of all operators. – Operator Precedence in Java
• Explain the syntax of constructing a condition and examine how that condition is evaluated.
• Explain branching/selection (including multi-conditional branching).
• Develop programs that use branching/selection, including multi-conditional branching. If Condition – Exercise
• Explain iteration and list examples where iteration is necessary to solve a given problem.
• Explain the use of post-test, pre-test and counting loops. Identify problems where loops are necessary and discuss the most suitable loop to use.
• Explain the different types of loops available in the chosen programming language and present the syntax of each type of iterative loop.
• Develop programs that demonstrate each type of iterative loop.
Notes
- If Else Statements – As above If Condition – Exercise
- Income Tax Rate Exercise
- Note: Efficient Code Exam Grades Exercise
- Switch Statement
- Input using read() method – Difference between read and scanner input
- Input using read() method – Exercise – Using Read Method Input Stream
- Euro_Note_Colour_Exercise
- Branching Statements
- Break Example – Branching
- Exercise – Using if conditional Statement
Section 5: Modularisation Learning Outcome 8 – Sample Code Functions_Modular_Programming Modules explained – video
Identify the need for modularisation, parameter passing and reusability. Create programs that use functions that can be reused. Examine the scope of variables and determine the most appropriate location for declaration.
• Identify the advantages of modularisation within a program.
• Differentiate between local and global variables and explain variable scope. – Local_Static_Instance_TypesOfVariables
• Explain the syntax of a simple module i.e. a module with no parameters and no returned value.
• Develop programs that use modules and use local and global variables according to best practice.
• Explain the advantages/reasons for passing parameters to a module within a program.
• Explain the syntax of a module that accepts parameters.
• Develop modular programs that pass one or more arguments to one or more modules within a program. – Java Functions and Creating Modular Code https://www.youtube.com/watch?v=EuX-X5hTjLw – Functions_Modular_Programming
• Explain the advantages/reasons for returning a value from a module within a program.
• Explain the syntax of a module that returns a value.
• Develop programs that contain modules that return a value.
• Explain system defined functions.
• Explain how a programmer can access system defined functions.
• Develop programs that use system defined functions.
Class Exercises
- Functions-in-Java-1
- Functions_Modular_Programming-1 – Functions_Modular_Programming
- Function to calculate distance from Cork City to Dublin City
- Formatting Numbers
- Formatting Numbers and Currencies
- Arrays Formatting Output
Checking Strings for permitted characters/digits – Pattern Matching
- Strings isDigit isLetter – Character Checking and Validating
- String Patterns
- Regex Pattern Matching
- Validating firstname and surname entries Validating Names
- Validating credit card number https://howtodoinjava.com/regex/java-regex-validate-credit-card-numbers/
- Validating using Patterns – Modular Programming
Section 6: Testing a program – Learning Outcome 10
Facilitate the user to devise suitable test data for each program that they code, to apply this test data to their code and to revise their code until it is accurate and reliable.
• Identify critical test data for each program. Ensure that the test data contains a good mix of values and that incorrect user input is tested and dealt with effectively.
• Develop test results for each item of test data including the output that should result from incorrect/invalid user entry.
• Match test results to actual results.
• Facilitate the user in identifying and correcting any syntax, logical and runtime errors in their code by using structured walk-throughs and debugging tools to locate and correct errors.
Section 7: Best practice Learning Outcome 11
Provide an awareness of industry standards and best practice in the following areas:
• Coding standards. https://android.jlelse.eu/java-coding-standards-ee1687a82ec2 – Code_Conventions
• Comments standards. – Use // for single line comment. Begin with multiple lines with /* and end with */
• Identifier names standards. – CamelCase/Hungarian Notation – https://www.javatpoint.com/java-naming-conventions
• Indentation standard. – indent to make code easier to read (indent between {} )
• Consistent screen design. – Use \n for new line, \t for tab indent or Formatting output using System.out.printf()
• Ease of use. – Simple efficient code with meaningful user prompts which makes your software easy to use.
• Error trapping and reporting. – Using_Try_Catch_to_prevent_crashes
Section 8: Programming as part of a team – Learning Outcome 12
Tools: Github, Asana, Trello, Teamwork
Project Management Software: Microsoft Project, OpenProj, ProjectLibre (free)
Set up teams of between three and five learners to develop one or more programs (defined by the assessor) through all its stages. Facilitate each team in:
• Discussing the problem to be solved.
• Identifying possible solutions to the problem.
• Identifying the best solution to the problem.
• Developing pseudocode for the problem that includes modularisation of the problem. – Functions_Modular_Programming
• Developing test data for the problem.
• Allocating one or more modules to each team member for development with best use of parameters and variable scope.
• Arranging the developed modules into one program.
• Testing the constructed program using the test data developed.
• Revising the developed program until it is reliable, accurate, efficient and adheres to industry standards.
• Releasing the developed program.
Exercises – Class Assessments
- Mid_Term_Student_Exercise
- Mid_Term_Break_Solution_Student_Averages
- Exercise: Toyota Cars – Pre Ass 1 Toyota Cars – Pre Ass 1 Solution: Toyota Cars – Pre Ass 1 Solution Test Data: Toyota Ireland Test Data
Language
- Java (Installation video – https://www.youtube.com/watch?v=YuFxDBG8IGQ)
GUI (Improving your graphic user interface
- JavaFX is a software platform for creating and delivering desktop applications, as well as rich Internet applications that can run across a wide variety of devices. JavaFX is intended to replace Swing as the standard GUI library for Java SE, but both will be included for the foreseeable future. – Installing JavaFX
Useful Sites
Webinars
- NetcomLearning (Java Classes/Inheritance/Polymorphism)- https://www.netcomlearning.com/webinars/viewer.phtml?a=show&id=22082&advid=871&skip=1
Recommended further study
- https://docs.oracle.com/javase/tutorial/getStarted/intro/cando.html
- https://docs.oracle.com/javafx/2/get_started/jfxpub-get_started.htm
- https://docs.oracle.com/javafx/2/get_started/form.htm
Screenshots Gallery – Java
Class Notes
Age_In_Years (incomplete)
0 Sample Java Source Code – Full Program
24 Draw the Flow Chart to calculate the volume of a cone
25 Draw the Flow Chart for Multiplication Tables
50 Input_Output_Dialogs_in_Java
Division by Zero – Error-Handling-Exceptions
Division by Zero – Error-Handling-Exceptions
- Bicycle_Hire_Code_Unfinished
- Toyota Cars – Pre Ass 1 – Toyota Cars – Pre Ass 1 Solution
- Arrays
- ArraysExample2
- Bicycle_Hire_Code_Unfinished
- Boolean Operators
- Branching – Nested Ifs
- Branching
- Checking_Letter_by_Letter
- Data Types and Maths Progs Exercises
- Data Types and Maths Progs
- Data Types available in Java
- Date_Time_TimeDifference
- Error Handling – Exceptions
- Exercise – Printg – For loop – Nested ifs -Date
- Exercise-Loop_until_CorrectValueInput
- Files-Input-Output
- Files-Input-Output-2
- Formatting Print Output
- Java Operators
- Loop Exercises
- Looping
- Loops – For – While – Do While
- Pre Skills Demo 2 – Sample Source Code to be Edited
- Printf – Nested Ifs – For Loop – Date
- Printf
- Printf_PrintingIn_Columns
- System Input and Output Math Exercises
- Toyota Ireland Test Data
- Types of Variables in Java
- Validate_Strings
- Validate-Characters-in-a-String
- ValidateName_tobeverified
- Variable Scope – Class and Locally declared Variables
0 Programming Design Principles – Rays notes
- 0 Program_Algorithms
- 0 ms-microsoft-visual-basic-2013-step-by-step
- 10 Algorithms
- 1 Flow Chart (designed in Word) or
- Flow Charts https://www.gliffy.com/
Class Exercises
- 5 Student Program
- Solving a Quadratic Equation
- 12 Quarterly Sales – Screen shots and Planning Note and VB code
- Calculate Standard Deviation – Standard Deviation Source Code
- Two Forms
- 17 Modules and Functions
- Student Results
- Display Arrays contents in a ListView
- Penalty Points Program
- Error Handling
Modularisation