Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithm development. The invention of the computer  Programming language developments: 1. Machine code 2. Assembler  easier to write, debug, and update.

Similar presentations


Presentation on theme: "Algorithm development. The invention of the computer  Programming language developments: 1. Machine code 2. Assembler  easier to write, debug, and update."— Presentation transcript:

1 Algorithm development

2 The invention of the computer  Programming language developments: 1. Machine code 2. Assembler  easier to write, debug, and update 3. High level languages  strive to be machine independent  easier to learn and use  1954 – FORTRAN  1961 – COBOL  then ALGOL, LISP, BASIC  1970 – Pascal  1980’s – C  1990’s – C++, Java (originally called ?)  and many, many others

3 High level langauges (HLL)  Not directly understood by the computer  Humanly readable  Requires the user of a compiler Compiler= program  Input= code written in a HLL  Output= machine code

4 Pascal (an HLL)  1970’s  Support for “structured programming” Control constructs 1. Linear sequence of commands/instructions 2. Repetition 3. Selection  Top-down programming  Problem is broken down into a series of smaller problems which are solved.  Divide-and-conquer technique.

5 Types of software 1. OS (operating system) 2. Programming environment/tools 3. Applications

6 Operating Systems (OS)  Windows  Linux Android (linux-based)  Unix  Mac OS  many others

7 Programming environments/tools  Tools emacs (an editor – not a word processor) vi g++ gdb

8 Programming environments/tools  IDE’s (Integrated Development Environment) consist of: editor, compiler or interpreter, debugger, linker examples: jGrasp, netbeans, Eclipse, Ready, Visual C++, Visual BASIC, JBuilder, and many others

9 Applications  Computer games  Word processors  Graphics packages  Virtual reality software  Web browsers  Presentation  Database  Spreadsheet  And many others.

10 Social issues  Privacy/anonymity  Quality of information

11 Program development  Our programming language is Java.  The IDE we will use is jGrasp. Editor is used to type in program text (it is not a word processor; don’t use a word processor). Compiler (syntax errors) Run/execute (semantic errors)

12 Program development  Java is an object-oriented language. (Note: Case sensitive.)  Method named operation constructor (ctor)  special method w/ same name as class  performs initialization  class may have more than 1 ctor  Class named group of related methods

13 Recall “What is a computer?” INPUT (information) PROCESSING OUTPUT (information) MEMORY

14 Definitions (from http://mathworld.wolfram.com/Algorithm.html)  An algorithm is a specific set of instructions for carrying out a procedure or solving a problem, usually with the requirement that the procedure terminate at some point.

15 Definitions (from http://mathworld.wolfram.com/Algorithm.html)  Specific algorithms sometimes also go by the names: method procedure routine subroutine technique

16 Definitions (from http://mathworld.wolfram.com/Algorithm.html) The word “algorithm” is a distortion of al-Khwārizmī, a Persian mathematician who wrote an influential treatise about algebraic methods.

17 Definitions (from http://mathworld.wolfram.com/Algorithm.html) The process of applying an algorithm to an input to obtain an output is called a computation.

18 Recall “What is a computer?” INPUT (information) PROCESSING OUTPUT (information) MEMORY  How can a Java program perform output?

19 How can a program perform output? System.out.println( "hello world" );

20 blocks { System.out.println( "Welcome!" ); System.out.println( "Enjoy the show." ); }

21 Method/function/procedure public static void main ( String param[] ) { System.out.println( "hi there" ); }

22 Defining our own objects class MyFirstClass { public static void main ( String param[] ) { System.out.println( "hi there" ); }

23 Recall “What is a computer?” INPUT (information) PROCESSING OUTPUT (information) MEMORY  How can a Java program perform input?

24 How can a Java program perform input? … Scanner s = new Scanner( System.in ); … String str = s.nextLine(); …

25 We can mix input and output. Scanner s = new Scanner( System.in ); System.out.print( "Enter your name: " ); String name = s.nextLine(); System.out.println( "Thanks." ); s.close();

26 Complete program that does both input & output. import java.util.Scanner; class MySecondClass { public static void main ( String param[] ) { Scanner s = new Scanner( System.in ); System.out.print( "Enter your name: " ); String name = s.nextLine(); System.out.println( "Thanks." ); s.close(); }


Download ppt "Algorithm development. The invention of the computer  Programming language developments: 1. Machine code 2. Assembler  easier to write, debug, and update."

Similar presentations


Ads by Google