Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

Chapter 1: Computer Systems
COMP425M Introduction to Programming
1 Kursusform  13 uger med: Undervisning i klassen 1,5-2 timer Opgave ”regning” i databar (løsninger på hjemmeside) En midtvejsopgave der afleveres og.
The Java Programming Language
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Computers: Tools for an Information Age
Aalborg Media Lab 21-Jun-15 Software Design Lecture 1 “ Introduction to Java and OOP”
Outline Java program structure Basic program elements
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 1 Introduction. © 2004 Pearson Addison-Wesley. All rights reserved1-2 Outline Computer Processing Hardware Components Networks The Java Programming.
Chapter 1 Introduction.
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
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.
Computer Science 101 Introduction to Programming.
Chapter 1 Introduction to Programming and the Java Language.
Chapter 1 Introduction.
Programming Languages: Telling the Computers What to Do Chapter 16.
HOW COMPUTERS MANIPULATE DATA Chapter 1 Coming up: Analog vs. Digital.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley John Lewis, Peter DePasquale, and Joseph Chase Chapter 1: Introduction.
UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
© 2006 Pearson Education Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science A 2nd Edition.
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
Java Language and SW Dev’t
Computer Science 101 Introduction to Programming.
© 2006 Pearson Education 1 Obj: cont 1.3 and 1.4, to become familiar with identifiers and to understand how programming languages work HW: p.51 #1.8 –
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
Chapter 1 Introduction 5 TH EDITION Lewis & Loftus java Software Solutions Foundations of Program Design © 2007 Pearson Addison-Wesley. All rights reserved.
The Java Programming Language
Introduction. Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2.
Java Chapter 1 Problem solving: 1. Understanding the problem. 2. Breaking the problem into manageable pieces. 3. Designing a solution. 4. Considering alternatives.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Chapter 1: Introduction Java Programming Language How the Java Virtual Machine Works (compiling, etc…) Update by: Dan Fleck Coming up: The Java Programming.
Java The Java programming language was created by Sun Microsystems, Inc. It was introduced in 1995 and it's popularity has grown quickly since A programming.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
Introduction to Java Java Translation Program Structure
© 2004 Pearson Addison-Wesley. All rights reserved ComS 207: Programming I Instructor: Alexander Stoytchev
1 Problem Solving b The purpose of writing a program is to solve a problem b The general steps in problem solving are: Understand the problemUnderstand.
Programming in Java (COP 2250) Lecture 2 Chengyong Yang Fall, 2005.
TCU CoSc Introduction to Programming (with Java) Java Language Overview.
Intro to Programming  Chapter 1 Part 2  Problem Solving.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Chapter 1 Introduction. 2 Focus of the Course Object-Oriented Software Development problem solving program design, implementation, and testing object-oriented.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Introduction to Computer Programming using Fortran 77.
© 2004 Pearson Addison-Wesley. All rights reserved January 23, 2006 Creating Objects & String Class ComS 207: Programming I (in Java) Iowa State University,
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 1: Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
1 Problem Solving  The purpose of writing a program is to solve a problem  The general steps in problem solving are: Understand the problem Dissect the.
Working with Java.
Lecture 1 Introduction Richard Gesick.
CSCI-235 Micro-Computer Applications
Lecture 1B Introduction Richard Gesick
Creating Objects & String Class
1.3 Problem Solving The purpose of writing a program is to solve a problem The general steps in problem solving are: Understand the problem Dissect the.
Chapter 1: Computer Systems
Java Software Solutions Foundations of Program Design 9th Edition
Focus of the Course Object-Oriented Software Development
ICT Programming Lesson 1:
Instructor: Alexander Stoytchev
Presentation transcript:

Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick

Agenda Overview of Programming Languages Basics of C# and the IDE Errors Intro to Objects and Classes 1-2

Programming Languages A programming language specifies the words and symbols that we can use to write a program A programming language employs a set of rules that dictate how the words and symbols can be put together to form valid program statements 1-3

Programming Languages Machine language Assembly language High-level languages 1-4

Machine & Assembly Languages Machine language – Written in binary or hex – Written using CPU instruction set – Difficult to write, and not portable Assembly language – Written using mnemonics for instructions and symbolic names for variables – Assembler converts code to machine language – Easier to write, but still not portable 1-5

High-Level Languages Examples: Fortran, Perl, COBOL, C++, Java Highly symbolic Portable among CPU architectures Languages can be designed for specific uses: – Perl: Internet applications – Fortran: scientific applications – COBOL: business applications 1-6

High-Level Languages Compiled – Compiler converts source code (instructions and data) into machine language, then program is executed Interpreted – Interpreter converts instructions into machine language at run time as instructions are executed – Usually executes more slowly than compiled program 1-7

1-8

Programming Basics Programming is translating a problem into ordered steps consisting of operations a computer can perform: – Input – Calculations – Comparisons of values – Moving data – Output The order of execution of instructions is called flow of control 1-9

Four Types of Flow of Control Sequential Processing – Execute instructions in order Method Call – Jump to code in method, then return Selection – Choose code to execute based on data value Looping or Iteration – Repeat operations for multiple data values 1-10

Program Development The mechanics of developing a program include several activities – writing the program in a specific programming language – translating the program into a form that the computer can execute – investigating and fixing various types of errors that can occur Software tools can be used to help with all parts of this process 1-11

Problem Solving The purpose of writing a program is to solve a problem Solving a problem consists of multiple activities: – Understand the problem – Design a solution – Consider alternatives and refine the solution – Implement the solution – Test the solution These activities are not purely linear – they overlap and interact 1-12

Problem Solving The key to designing a solution is breaking it down into manageable pieces When writing software, we design separate pieces that are responsible for certain parts of the solution An object-oriented approach lends itself to this kind of solution decomposition We will dissect our solutions into pieces called objects and classes 1-13

Program Skeleton 1-14

1-15

Games Example 1-16 using System; namespace CastleAttack { static class Program { /// /// The main entry point for the application. /// static void Main(string[] args) { using (CastleAttack game = new CastleAttack( )) { game.Run(); }

Identifiers Words in programs Categories: – We make up – Others make up – Reserved in the language 1-17

C# Identifiers Letter followed by zero or more letters and digits Case sensitive 1-18

1-19

1-20

White Space Spaces, blank lines, and tabs are called white space White space is used to separate words and symbols in a program Extra white space is ignored A valid C# program can be formatted many ways Programs should be formatted to enhance readability, using consistent indentation 1-21

Comments Comments in a program are called inline documentation They should be included to explain the purpose of the program and describe processing steps They do not affect how a program works C# comments can take two forms: 1-22 // this comment runs to the end of the line /* this comment runs to the terminating symbol, even across line breaks */

Syntax and Semantics The syntax rules of a language define how we can put together symbols, reserved words, and identifiers to make a valid program The semantics of a program statement define what that statement means (its purpose or role in a program) A program that is syntactically correct is not necessarily logically (semantically) correct A program will always do what we tell it to do, not what we meant to tell it to do 1-23

Errors A program can have three types of errors The compiler will find syntax errors and other basic problems (compile-time errors) – If compile-time errors exist, an executable version of the program is not created A problem can occur during program execution, such as trying to divide by zero, which causes a program to terminate abnormally (run-time errors) A program may run, but produce incorrect results, perhaps using an incorrect formula (logical errors) 1-24

Program Errors Compiler errors – Found by the compiler. – Usually caused by incorrect syntax or spelling Run-time errors – Reported by the system – Usually caused by incorrect use of prewritten classes or invalid data Logic errors – Found by testing the program – Incorrect program design or incorrect execution of the design 1-25

Expect Errors 1-26

.NET 1-27

Program Structure In the C# programming language: – A program is made up of one or more classes – A class contains one or more methods – A method contains program statements These terms will be explored in detail throughout the course An application always contains a method called Main 1-28

Object-oriented Programming (OOP) Class – tool for encapsulating data and operations (methods) into one package – defines a template or model for creating and manipulating objects Objects – data created using the class and its methods – an object is an instance of the class – creating an object is instantiation 1-29

Objects An object has: – state - descriptive characteristics – behaviors - what it can do (or what can be done to it) The state of a bank account includes its current balance The behaviors associated with a bank account include the ability to make deposits and withdrawals Note that the behavior of an object might change its state 1-30

Classes An object is defined by a class A class is the blueprint of an object The class uses methods to define the behaviors of the object The class that contains the main method of a C# program represents the entire program A class represents a concept, and an object represents the embodiment of that concept Multiple objects can be created from the same class 1-31

1-32

Objects and Classes Bank Account A class (the concept) John’s Bank Account Balance: $5,257 An object (the realization) Bill’s Bank Account Balance: $1,245,069 Mary’s Bank Account Balance: $16,833 Multiple objects from the same class

Class and Object Example 1-34 How would you describe or define these pictures? What are the differences? What are the similarities? Are you describing a single entity or an entire group of entities?

What might the classes be? Objects?

Summary So what did you learn? Name three important concepts from the first two lectures. What would I put on a test?