School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 1 CMT1000: Introduction to Programming Ed Currie Lecture 2B: Programming.

Slides:



Advertisements
Similar presentations
Agenda 1. PowerPoint presentation on “the process of programming” (emphasis on terminology). 2. Assignment 1 (to be handed in by the end of the class)
Advertisements

Programming TBE 540 Farah Fisher. Objectives After viewing this presentation, the learner will be able to… Given a task, create pseudocode Given pseudocode,
JAVA BASICS SYNTAX, ERRORS, AND DEBUGGING. OBJECTIVES FOR THIS UNIT Upon completion of this unit, you should be able to: Explain the Java virtual machine.
Chapter 1: Introduction
Python Programming Chapter 1: The way of the program Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
Lecturer: Fintan Costello Welcome to Hdip 001 Introduction to Programming.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 4: 1 CMT1000: Introduction to Programming Ed Currie Lecture 4: Storing and.
©2004 Brooks/Cole Chapter 1: Getting Started Sections Covered: 1.1Introduction to Programming 1.2Constructing a Java Program 1.3The print() and println()
School of Computing Science CMT1000 © Ed Currie Middlesex University Lecture 10: 1 TEST!!
School of Computing Science CMT1000 Ed Currie © Middlesex University 1 CMT1000: Introduction to Programming Ed Currie Lecture 5B: Branch Statements - Making.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
School of Computing Science CMT1000 © Ed Currie Middlesex University Lecture 3: 1 CMT1000: Introduction to Programming Ed Currie Lecture 3: Program structure.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 4: 1 CMT1000: Introduction to Programming Ed Currie Lecture 5a: Input and.
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
School of Computing Science CMT1000 © Ed Currie Middlesex University 1 CMT1000: Introduction to Programming Ed Currie Lecture 1B: Problem Solving.
1 Programming Languages Translation  Lecture Objectives:  Be able to list and explain five features of the Java programming language.  Be able to explain.
Welcome to COMP 1001 First Year Computer Science Lecturer: Fintan Costello.
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
1 Programming Languages Examples: C, Java, HTML, Haskell, Prolog, SAS Also known as formal languages Completely described and rigidly governed by formal.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Concept of Computer Programming November 2, 2011.
Activity 1 - WBs 5 mins Go online and spend a moment trying to find out the difference between: HIGH LEVEL programming languages and LOW LEVEL programming.
ITP © Ron Poet Lecture 1 1 IT Programming Introduction.
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
1 Chapter-01 Introduction to Computers and C++ Programming.
Introducing Java.
From BlueJ to NetBeans SWC 2.semester.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Basics Programming Concepts. Basics A computer program is a set of instructions to tell a computer what to do Machine language = circuit level language.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Chapter 1 Introduction. Goal to learn about computers and programming to compile and run your first Java program to recognize compile-time and run-time.
Chapter 1: Introduction to Programs, and Java 1. Objectives To review programs (§ ). To understand the relationship between Java and the World Wide.
Python From the book “Think Python”
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
What does a computer program look like: a general overview.
Chapter 1 Section 1.1 Introduction to Java Slides prepared by Rose Williams, Binghamton University Kenrick Mock, University of Alaska Anchorage.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Robert Crawford, MBA West Middle School.  Explain how the binary system is used by computers.  Describe how software is written and translated  Summarize.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Introduction to programming in the Java programming language.
Review, Pseudocode, Flow Charting, and Storyboarding.
School of Computer Science & Information Technology G6DICP - Lecture 6 Errors, bugs and debugging.
ERRORS. Types of errors: Syntax errors Logical errors.
Programming Errors. Errors of different types Syntax errors – easiest to fix, found by compiler or interpreter Semantic errors – logic errors, found by.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction to Computers, Programs,
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
© Peter Andreae Java Programs COMP 102 # T1 Peter Andreae Computer Science Victoria University of Wellington.
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Copyright 2010 by Pearson Education APCS Building Java Programs Chapter 1 Lecture 1-1: Introduction; Basic Java Programs reading:
Software Development Languages and Environments. Computer Languages Just as there are many human languages, there are many computer programming languages.
Topic: Programming Languages and their Evolution + Intro to Scratch
Introduction CSE 1310 – Introduction to Computers and Programming
String Output ICS 111: Introduction to Computer Science I
Fundamentals of Programming
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Programming.
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Lecture 8 Programming Paradigm & Languages. Programming Languages The process of telling the computer what to do Also known as coding.
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Zorah Fung University of Washington, Winter 2016
Presentation transcript:

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 1 CMT1000: Introduction to Programming Ed Currie Lecture 2B: Programming Languages

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 2 Giving Plans To Computers To get a computer to do things we must give it detailed plans in a form it understands (programs) What language do we write the detailed plans in? –English? –Swahili? Human Languages are not suitable We use special programming languages

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 3 Why? … Human languages are –Hard to process –Ambiguous This is why we have the most powerful computers on Earth in our heads!

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 4 Why Special Languages? Do we just need to be careful? –Laws/contracts are written that way –Lawyers have been making $$$ because of the ambiguities for centuries Delia Smith's cookery books use careful English –I still can't make a good cheese sauce every time "stir until thickened"?? –Mr Kipling makes exceedingly identical cakes though … How?

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 5 Programming Languages Designed to be –unambiguous –easy to process –consist of instructions the computer knows about –and how to follow BUT We can use English to help us solve the problem –only the last step needs to be in a programming Language

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 6 Computer Languages There are lots. Here are just a few that have been popular at different times. 1960sALGOLFORTRAN COBOL 1970sSIMULAPASCAL ADA 1980sMODULA-2C sMODULA-3JAVA

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 7 Why Different Languages? There are many reasons why there are so many different languages –Evolution New ones might be easier to use than older ones e.g., include features for avoiding errors –Different jobs nuclear power plant controller human computer interfaces graphics programming www programming –Different prejudices/fashions brevity

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 8 Aim Of This Course You should understand the common programming concepts –Java will be used as an example good programming practice how to find and avoid programming errors

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 9 What A Computer Really Understands …

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 10 // Prints ‘Hello’ on the screen in a dialog box import javax.swing.JOptionPane; // import class JOptionPane public class Hello1 { public static void main( String args[] ) { JOptionPane.showMessageDialog(null, "Hello!" ); System.exit( 0 ); // terminate the program }

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 11 Compiling To turn a program into a form the computer can execute –it must be compiled. A compiler just translates a program written in one language (as above) into another –where the only letters allowed in the language are 1 and 0

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 12 Compiler Detected Errors When humans write programs - they always make mistakes –like when I try to speak French! The compiler picks up many simple errors. These errors are similar to errors I might make if trying to write in a foreign language –or even in English sometimes

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 13 English Syntax Errors punctuation and spelling: –The cat sat on the mat i eight fish grammar: –The sat cat on the mat. I fish ate. These are called syntax errors. –You do not need to know the meaning of the sentences to see these are mistakes, just the rules of grammar –eg "there should be a verb next” There are similar "syntax" rules for programs –punctuation, spelling and grammar rules

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 14 Run-time Errors Run-time errors are ones the compiler cannot detect. Consider: "I was born on the 35th December, 1864.” –This is perfectly good English but it has a semantic error. –You need to know more than grammar to see this. –You must know what the words mean. Programs can also have semantic errors –they are only detected by running the program. –The program is a perfectly good program –it just does something other than what was intended They will often be due to mistakes in the algorithm.

School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 15 Summary Plans must be written using special languages for computers which are: –unambiguous –easy to process Different languages have evolved from each other for different purposes A compiler converts the program to a form the computer can execute. It also catches syntax errors but not semantic errors.