CHAPTER-4 Steps in program development and develop a simple Java
Program Objectives ➢ After this course, you should be able to understand ➢ Steps of Program Development and Problems Solutions ➢ A Typical Java Development Environment ➢ Preparation for manual Java program development ➢ Simple java program development ➢ Java program compilation and execution
Information Technology & Japanese Language Education Center
Steps in program Development ➢ Computer programming is an art. ➢ Many people believe that programmer must be good at mathematics , have a memory for figure and technical information and be prepared to spend many hours sitting at a computer , typing programs. But given the right tools ,and steps to follow , anyone can write well-designed programs. It is a task worth doing as it is both stimulating and fulfilling.
Information Technology & Japanese Language Education Center
1)Define the problem ➢ -Involvescarefully reading and rereading the problems until you understand completely what is required . To help with this initials analysis. ➢ The problem should be divided into 3 separate components. ➢ The inputs ➢ The outputs , and ➢ The processing steps to produce the required inputs.
Information Technology & Japanese Language Education Center
2)Outline the solution ➢ After the problem has been defined , you may decide to break the problem up into smaller task or steps and establish an outline solution. ➢ Than initial outline is usually a rough draft of the solution which include: ➢ The major processing steps involved, ➢ The major subtask(if any), ➢ The major control structures(eg. repetitions loops ,decision making if,switch) ➢ The major variables and record structures , and ➢ The mainline logic.
Information Technology & Japanese Language Education Center
3)Develop the outline into an algorithm ➢ What is Algorithm? ➢ It is a finite set of instructions that it follows a complete particular task. ➢ It is set of precise steps that describe exactly the tasks to be preformed and order in which they are to be carried out. ➢ It lists the steps involved in accomplishing a task. ➢ Eg: pseudocode (a form of structured English) to represent the solution algorithm
Information Technology & Japanese Language Education Center
4)Test the algorithm for correctness ➢ -one of the most important in development of programs, and it is the step most often forgotten. ➢ -main purpose of checking the algorithm is to identify major logic errors early so that they may be easily corrected. ➢ Test data needs to be walked through each step in the algorithm to check that the instructions described in the algorithm will actually do what they are supposed.
Information Technology & Japanese Language Education Center
5)Code the algorithm into a specific programming languages. ➢ Onlyafter all design considerations have been met in the previous for steps should you actually start to code the program into your chosen programming language.
Information Technology & Japanese Language Education Center
6)Run the program on the computer ➢ Use a program compiler/interpreter/programmer- designed test data to machine test the code for syntax errors(those detected at compile time)and logic errors(those detected at run time).
➢ Usually the most rewarding step in the program development processes.
Information Technology & Japanese Language Education Center
7)Document and maintain the program ➢ Program documentation should not be listed as the step in the program development process ,as it is really an ongoing task from the initial definition of problem to final test result.Documentation involves both external documentation(such hierarchy chart ,the solution algorithm ,and test data result) and internal document that may have be coded in the program.
Information Technology & Japanese Language Education Center
What is Java? ➢ Java is a general-purpose programming language that is class- based, and designed to have as few implementation dependencies as possible. ➢ It is intended to let application developers write once, run anywhere(WORA),meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. ➢ Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. ➢ The syntax of Java is similar to C and C++, but it has fewer low- level facilities than either of them. ➢ As of 2018, Java was one of the most popular programming languages in use according to GitHub ,particularly for client-server web applications, with a reported 9 million developers.
Information Technology & Japanese Language Education Center
Why Java? ➢ 1) Java is Easy to learn ➢ 2)Java is an Object-Oriented Programming Language ➢ 3)Java has Rich API ➢ 4)Powerful development tools e.g., Eclipse, Netbeans ➢ 5)Great collection of Open Source libraries ➢ 6)Wonderful Community Support ➢ 7)Java is FREE ➢ 8)Excellent documentation support - Javadocs ➢ 9)Java is Platform Independent ➢ 10)Java is Everywhere ➢ 11)Job opportunities and latest trends ➢ and others ....
Information Technology & Japanese Language Education Center
What is write once, run anywhere(WORA)?
Information Technology & Japanese Language Education Center
What is write once, run anywhere(WORA)?
Information Technology & Japanese Language Education Center
A Typical Java Development Environment
Information Technology & Japanese Language Education Center
A Typical Java Development Environment
Information Technology & Japanese Language Education Center
A Typical Java Development Environment
Information Technology & Japanese Language Education Center
A Typical Java Development Environment
Information Technology & Japanese Language Education Center
A Typical Java Development Environment
Information Technology & Japanese Language Education Center
Write Java program in notepad and then compile and run(Execute) the program.
Hellowrold.java(Source code) Output of Hellowrold Java Program
Compile Java Program >>javac FileName.java Run(Execute) Java Program>>java FileName (Note:class ‘s name and file ‘s name must be the same. Eg class name is Hellowrold and then file name must be save as Hellowrold.java)
Information Technology & Japanese Language Education Center
Java Compilation Process for Simple.java file
Information Technology & Japanese Language Education Center
Special Characters when program developing
Information Technology & Japanese Language Education Center
The Java program-development process consists of repeatedly creating/modifying source code, compiling, and executing programs.
Information Technology & Japanese Language Education Center
Output
➢ Correct Result
➢ Error!!!!!
➢ Why error ? How many type of error?
Information Technology & Japanese Language Education Center
Today Result
Information Technology & Japanese Language Education Center
Homewrok ➢ Printing out your name ➢ Name.java
➢ Print out your name as 5 time in console. ➢ Name5time.java
➢ Calculate the value of 5x5x5
➢ Calc.java
Information Technology & Japanese Language Education Center
Reference link ➢ https://docs.oracle.com/javase/8/docs/technotes/ guides/install/install_overview.html
Information Technology & Japanese Language Education Center