Your SlideShare is downloading. ×
Fifth   software
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Fifth software

987
views

Published on

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
987
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
55
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • I. A. How to communicate with computers Plan what to say Chose the best phrasing Actually say it (encode it) Wait for response Computers follow instructions created by programmers Deterministic No options Very methodical No free will Given the same data, exactly the same results will occur every run
  • Humans write in programming languages, these get translated into binary. A separate program does the translation
  • II. Difference between human talk and machine talk Def: Programming language: a series of specifically defined commands designed by human programmers to give directions to digital computers. Each program solves a particular problem or performs a specific task A. Def: Semantics – meaning: Commands we want the computer to perform, the meaning of these commands. Each line of a computer language command can have ONE meaning only. What does it mean to perform an add, it means the contents of memory are added to the contents of the accumulator B. Def: Syntax: Grammatical form or structure of a language. Rules governing the language, in English = spelling and punctuation Syntax in computers is very strict EX. in Java must have a semi-colon ; after every instruction C. Participants Humans -----> Machines
  • EX: Add two numbers together and store them. Load register 1 from position 9 5 8 1 9 MachineCode: 0101 1000 0001 1001 Assembly L R1 9 A R1 57 ST R1 1024
  • Computer Clock Computers do one instruction per cycle (either fetch or execute) The number of cycles the computer does in one second is determined by the computer’s clock Clock measures in megahertz Mega of cycles per hertz Mega is millions Hertz is seconds Example, a 1000 MHz ticks a billion times per second One gigahertz is 1000 MHz or a billion times per second
  • An assembler program was used to translate: Programmers wrote “Source” code and the Assembler created “Object” or machine code. Data \\/ Humans --> Programming language --> Compiler/Assembler --> Binary Code --> Computer \\|/ SOURCE TRANSLATOR OBJECT Results
  • Give Example of Hi level languages =========================================================== Second generation First Generation Hi-level language VS Assembler sum = subtotal + tax; VS L subtotal A tax St sum Data \\/ Humans --> Programming language --> Compiler/Assembler --> Binary Code --> Computer \\|/ SOURCE TRANSLATOR OBJECT Results
  • Object Oriented Programming – data and instructions together Object Oriented design tries to mirror the underlying structure of the real world Objects are the nouns (or entities ) of any situation EXAMPLE: . Take for example, a company. Nouns might be: Company, Department, Employees Products We take each noun and say what the data and behavior is of that noun EXAMPLE: _______________ Class-section Classes-section # Professor name Class room # Give Lecture Give Lab ______________ | Students | Student Grade Student SS# Class-section Mid Grade Final Grade Record Grades | | | name | | address | | year | | ss# | | | | | | take classes | | get grades | | | Each of these Objects relate to other objects in the system. So for example: Student <--------------------------------------->Class-sections one Student may relate to many Class-sections one Class-section may have many students relating to it.
  • ADVANTAGES of OO 1. Close to the way people think – OO mirrors the underlying structure of the real world Look for the underlying structure within a situation that will always be true, not just for one system. 3. Uses the idea of abstraction: Black Box. If I know how to use the Object, I do not needed to know the details of how it does what it does. If you know the Goes intos and the Goes out ofs, you do not need to know the details of how it is done 4. There are libraries of code that the programmer can use. Especially handy for Graphical User Interface = GUI Each of the “Objects” of the system is coded up and then they can be re-used in many situations. >>>> Henry Ford and Deusenberg (1920s) RE-use is a big OO phrase and reason why people go to the OO technique
  • . WOW – looks good on the surface, why not do this all the time? Reads a line and performs it 4. NO Free Lunch -- (I wrote an interpreter. To do 10 different instructions it took 2500 instructions) 5. Interpreted performance is Much slower a. Useful when running once or twice b. Production jobs, a job run over and over again – should NOT BE INTERPRETED, but compiled into efficient machine code Translation: assembler – entire program translated before execution compiler – entire program translated before execution interpreter – each line is translated and executed one by one
  • A. Macros Def: A set of operations that has been recorded for later use. Once checked out and saved, the macro can be used many times by different applications. Example: in Java we are printing out our Name in a box in each program. my print routine. We use this in every program
  • We will learn more about HTML next week and will write our own tag – almost every line of HTML contains a tag. A tag is a formatting instruction in HTML. The language that specifies the design and layout of the Web pages. Each tag is delineated by an < > both before and after to set it apart. <title> .....</title>
  • C. Scripting Means by which programmers add extensions or additional capabilities to an application. A script is a series of commands written to accomplish some task. It is very similar to the concept of a program, but not as large or comprehensive. EXAMPLE: JavaScript is a scripting language that allows the web page designer to add functional features to a formatted web page created with Html
  • Use: Loaf of Bread Jar of Peanut Butter Jar of Jam Have students write an algorithm in teams of 2 people Chose 5 teams to write algorithm on the board. Start with poorest algorithm and act out making of a PB&J sandwich. Student will gain the knowledge of why a detailed algorithm is needed.
  • Understand the Problem: EXAMPLE – write out names of students in class = Questions arise: Where do we get the names How many names Do the names change from year to year Do we save the names for future use or do we just print them and then delete them In what order do we want to print the names Do I want to know the number of names that I read in? ==========================================
  • Detailed description of exact methods used for solving the problem Logical can be in the form of a flow chart or in pseudocode (English like description) Play computer after the diagram is done Try some sample numbers
  • Write the Program – code according to the block diagram in the assembler language or the hi-level language that suits your computer and your company’s standards Make certain that comments are added to the program Make certain that the pseudo code or flow charts requirements, user acceptance tests are all part of the package so that someone else can pick up the program and you can get promoted People have been held back from promotions because no one could take over their programs
  • Test and Debug program Syntax Errors – Compiler / assembler catches these. Each language has its own rules. For example at the end of each instruction in JAVA you must have a semi-colon. Without this the compiler tells you it can not produce machine code. Logic error. Test with different sets of data -- wanted to print out Barb Zimmerman but printed out ZZZZZZ Zimmerman. Try bad data. What happens if you put in numbers instead of letters. Does the program give you an error message or does it blow up? How long a name will it accept. – is it long enough Try boundary conditions. one student. no students, 100 students. Make certain it still works User Acceptance testing. When you first get the requirements for a job. You need to decide with the people that will use the program what exactly will constitute acceptance on their part. They may say that they will want to see the program run, run it themselves for 1 week – Once the user accepts the job, they need to sign off that you delivered what you promised.
  • We discussed assemblers, compilers, and interpreters and explained why interpreted code was slower than compiled coded We talked about algorithms and how detailed they must be
  • Transcript

    • 1. Algorithms and Program Development By: Ashutosh Kasera
    • 2. Communicating with a Computer
      • Programming languages bridge the gap between human thought processes and computer binary circuitry.
        • Programming language : A series of specifically defined commands designed by human programmers to give directions to digital computers.
          • Commands are written as sets of instructions, called programs .
          • All programming language instructions must be expressed in binary code before the computer can perform them.
    • 3. The Role of Languages in Communication
      • Three fundamental elements of language that contribute to the success or failure of the communication cycle:
        • Semantics – meaning of commands
          • In computer, each command has ONE meaning
        • Syntax
          • Grammatical form
        • Participants
          • Human to Machine
    • 4. The Role of Languages in Communication
      • Human language:
        • Refers to the meaning of what is being said.
        • Words often pick up multiple meanings.
        • Phrases sometimes have idiomatic meanings:
          • let sleeping dogs lie
          • (don’t aggravate the situation by “putting in your two cents”)
      • Computer language:
        • Refers to the specific command you wish the computer to perform.
          • Input, Output, Print
          • Each command has a very specific meaning.
          • Computers associate one meaning with one computer command.
      • Semantics : Refers to meaning.
    • 5. The Role of Languages in Communication
      • Human language:
        • Refers to rules governing grammatical structure.
          • Pluralization, tense, agreement of subject and verb, pronunciation, and gender.
        • Humans tolerate the use of language.
          • How many ways can you say no? Do they have the same meaning?
      • Computer language:
        • Refers to rules governing exact spelling and punctuation, plus:
          • Formatting, repetition, subdivision of tasks, identification of variables, definition of memory spaces.
        • Computers do not tolerate syntax errors.
      • Syntax : Refers to form, or structure.
    • 6. The Role of Languages in Communication
      • Human language:
        • In the communication cycle, humans can respond in more than one way.
          • Body language
          • Facial expressions
          • Laughter
          • human speech
      • Computer language:
        • People use programming languages.
        • Programs must be translated into binary code.
        • Computers respond by performing the task or not!
      • Participants :
        • Human languages are used by people to communicate with each other.
        • Programming languages are used by people to communicate with machines.
    • 7. The Programming Language Evolution
      • In the beginning… To use a computer, you needed to know how to program it.
      • Today… People no longer need to know how to program in order to use the computer.
      • Investigate how programming languages evolved.
        • First Generation - Machine Language (code)
        • Second Generation - Assembly Language
        • Third Generation - People-Oriented Programming Languages
        • Fourth Generation - Non-Procedural Languages
        • Fifth Generation - Natural Languages
    • 8. The Programming Language Evolution
      • First Generation - Machine Language (code)
        • Machine language programs were made up of instructions written in binary code.
          • This is the “native” language of the computer.
          • Each instruction had two parts: Operation code, Operand
            • Operation code ( Opcode ): The command part of a computer instruction.
            • Operand : The address of a specific location in the computer’s memory.
          • Hardware dependent : Could be performed by only one type of computer with a particular CPU.
    • 9. Review from Hardware Fetch / Execute Cycle
      • Fetch Cycle
        • Instructions are “fetched” from the address in the program counter
      • Execute Cycle
        • The computer “understands” the binary and does what the instruction says to do.
        • Actual instructions are very simple
          • Add, multiply, divide
          • Logical AND / OR
          • Move information around in memory
          • Sense Input / Output
      • Governed by the Computer Clock
    • 10. The Programming Language Evolution
      • Second Generation - Assembly Language
        • Assembly language programs are made up of instructions written in mnemonics.
            • Mnemonics : Uses convenient alphabetic abbreviations to represent operation codes, and abstract symbols to represent operands.
            • Each instruction had two parts: Operation code, Operand
            • Hardware dependent.
            • Because programs are not written in 1s and 0s, the computer must first translate the program before it can be executed. -assembler
      READ num1 READ num2 LOAD num1 ADD num2 STORE sum PRINT sum STOP
    • 11. The Programming Language Evolution
      • Third Generation - People-Oriented Programs
        • Instructions in these languages are called statements.
          • High-level languages : Use statements that resemble English phrases combined with mathematical terms needed to express the problem or task being programmed.
          • Transportable: NOT-Hardware dependent.
          • Because programs are not written in 1s and 0s, the computer must first translate the program before it can be executed.
        • We use a Compiler to translate to binary code
          • One line of source code becomes multiple lines of binary Object code
    • 12. The Programming Language Evolution
      • Languages continue to evolve
        • Many are associated with specific application packages.
        • Programming-like systems aimed at simplifying the programmers task of imparting instructions to a computer.
          • Query Languages:
          • Report Writers:
          • Application Generators:
    • 13. The Programming Language Evolution
      • Fourth Generation -
        • Object-Oriented Languages : A language that expresses a computer problem as a series of objects a system contains, the behaviors of those objects, and how the objects interact with each other.
          • Object : Any entity contained within a system.
          • Some popular language examples: C++, Java, Smalltalk
    • 14. Advantages of OO
      • Close to the way people think – stable system
      • Abstraction
        • Once you know what the inputs and outputs are you can use objects without understanding the details of the programming
      • Libraries of code exist
      • Excellent for Graphical User Interface Programs
      • Re-use
    • 15. The Programming Language Evolution
      • Natural Languages
        • Languages that use ordinary conversation in one’s own language.
        • Research and experimentation toward this goal is being done.
          • Effortless, error-free natural language programs are still some distance into the future.
    • 16. Assembled, Compiled, or Interpreted Languages
      • All programs must be translated before their instructions can be executed.
      • Computer languages can be grouped according to which translation process is used to convert the instructions into binary code:
        • Assemblers
        • Interpreters
        • Compilers
    • 17. Assembled, Compiled, or Interpreted Languages
      • Assembled languages :
        • Assembler: a program used to translate Assembly language programs.
        • Produces one line of binary code per original program statement.
          • The entire program is assembled before the program is sent to the computer for execution.
    • 18. Assembled, Compiled, or Interpreted Languages
      • Interpreted Languages:
        • Interpreter: A program used to translate high-level programs.
        • Translates one line of the program into binary code at a time:
          • An instruction is fetched from the original source code.
          • The Interpreter checks the single instruction for errors. (If an error is found, translation and execution ceases. Otherwise…)
          • The instruction is translated into binary code.
          • The binary coded instruction is executed .
          • The fetch and execute process repeats for the entire program.
    • 19. Assembled, Compiled, or Interpreted Languages
      • Compiled languages :
        • Compiler: a program used to translate high-level programs.
        • Translates the entire program into binary code before anything is sent to the CPU for execution.
          • The translation process for a compiled program:
            • First, the Compiler checks the entire program for syntax errors in the original source code .
            • Next, it translates all of the instructions into binary code.
              • Two versions of the same program exist: the original source code version, and the binary code version ( object code ).
            • Last, the CPU attempts execution only after the programmer requests that the program be executed.
    • 20. Programming for Everyone
      • Several ways to control what your computer does or the way it accomplishes a particular task:
        • Using Macros
        • Using HTML to create Web Pages
        • Scripting
      • Each allows customization of current applications.
    • 21. Programming for Everyone
      • Using Macros
        • Macro : Set of operations within the computer application that have been recorded for later execution.
          • Once recorded, the macro can be used repeatedly on any document within that application.
    • 22. Programming for Everyone
      • Using HTML to create Web Pages
        • HTML (HyperText Markup Language): A computer language consisting of special codes intended to design the layout (or markup) of a Web page.
          • Web browsers interpret the HTML code and display the resulting Web pages.
          • Web browser: A program that displays information from the WWW.
          • Each line of HTML is called a tag (formatting instruction).
    • 23. Programming for Everyone
      • Scripting
        • Scripting : A series of commands, written to accomplish some task.
          • Very similar to the concept of a program.
          • Extends the capabilities of the application where it is being used.
          • Examples of scripting languages:
            • VBScript, JavaScript
            • JavaScript : A scripting language that allows the Web page designer to add functional features to a formatted web page created in HTML.
    • 24. Building a Program
      • Whatever type of problem needs to be solved, a careful thought out plan of attack, called an algorithm, is needed before a computer solution can be determined.
          • 1) Developing the algorithm.
          • 2) Writing the program.
          • 3) Documenting the program.
          • 4) Testing and debugging the program.
    • 25. Building a Program
      • 1) Developing the algorithm.
        • Algorithm : A detailed description of the exact methods used for solving a particular problem.
        • To develop the algorithm, the programmer needs to ask:
          • What data has to be fed into the computer?
          • What information do I want to get out of the computer?
          • Logic : Planning the processing of the program. It contains the instructions that cause the input data to be turned into the desired output data.
    • 26. Building a Program
      • A step-by-step program plan is created during the planning stage.
      • The two major notations for planning detailed algorithms:
        • Flowchart : Series of visual symbols representing the logical flow of a program.
        • Pseudocode : A verbal shorthand method that closely resembles a programming language, but does not have to follow a rigid syntax structure.
    • 27. Building a Program Start Count Money Do you have more than $10.00? Go out Go home End No Yes 1. If money < $10.00 then go home Else Go out 2. Count money 3. Go to number 1 Pseudocode: Flow chart:
    • 28. Building a Program
      • 2) Writing the Program
        • If analysis and planning have been thoroughly done, translating the plan into a programming language should be a quick and easy task.
      • 3) Documenting the Program
        • During both the algorithm development and program writing stages, explanations called documentation are added to the code.
    • 29. Building a Program
      • 4) Testing and Debugging the Program.
        • The program must be free of syntax errors .
        • The program must be free of logic errors .
        • The program must be reliable . (produces correct results)
        • The program must be robust . (able to detect execution errors)
        • User Acceptance testing
        • Alpha testing : Testing within the company.
        • Beta testing : Testing under a wider set of conditions using “sophisticated” users from outside the company.
    • 30. Summary
      • We traced the evolution of computer programs from machine code to high level languages
      • We spoke about Object Oriented languages and why they are used today
      • We discussed assemblers, compilers, and interpreters
      • We talked about the steps needed to create a program
      • We concluded by describing the various types of testing