INTRODUCING OUR LANGUAGE: C# CHAPTER 17 1. Topics  The Features of C# –C# is a Compiled Language –C# is Managed Code –C# is Strongly Typed –C# is Function.

Slides:



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

compilers and interpreters
Topics Introduction Types of Errors Exceptions Exception Handling
Chapter 1 Chapter 2 Chapter 3 Code Gone Wrong Random 5 pt 5 pt 5 pt
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
The Web Warrior Guide to Web Design Technologies
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
INTRODUCING OUR LANGUAGE: C# CHAPTER Topics  The Features of C# –C# is an Interpreted Language –C# is Managed Code –C# is Strongly Typed –C# is.
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
Programming Languages: Notes for Class Discussion: V Deena Engel’s class.
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
CS1061 C Programming Lecture 2: A Few Simple Programs A. O’Riordan, 2004.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Java An introduction. Example 1 public class Example1 { public static void main (String [] args) { System.out.println (“This is the first example”); int.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Guide To UNIX Using Linux Third Edition
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
Computer Programming 12 Mr. Jean March 3 rd, 2014.
Chapter Introduction to Computers and Programming 1.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
A First Program Using C#
Introduction to Python
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
Introduction to Java CSIS 3701: Advanced Object Oriented Programming.
Software Overview. Why review software? Software is the set of instructions that tells hardware what to do The reason for hardware is to execute a program.
Chapter 3 Processing and Interactive Input. 2 Assignment  The general syntax for an assignment statement is variable = operand; The operand to the right.
Programming With C.
Input, Output, and Processing
Java Programming, Second Edition Chapter One Creating Your First Java Program.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 1 Simple Python Programs Using Print, Variables, Input.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals. Procedural Constructs -
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
©2016 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. CSC 110 – INTRO TO COMPUTING - PROGRAMMING Overview of Programming.
Introduction Chapter 1 1/22/16. Check zyBooks Completion Click on the boxes for each section.
COP 2551 Introduction to Object Oriented Programming with Java Topics –Introduction to the Java language –Code Commenting –Java Program Structure –Identifiers.
Chapter 1: Introduction to Computers and Programming.
UFCFY5-30-1Multimedia Studio Coding for Interactive Media Fundamental Concepts.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
S Introduction Animation & Computer Games A (very) short introduction.
Topics Designing a Program Input, Processing, and Output
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2017
High and low level languages
Introduction to the C Language
Pamela Moore & Zenia Bahorski
Type Conversion, Constants, and the String Object
Introduction to the C Language
Introduction to the C Language
Building Java Programs Chapter 2
Topics Introduction Hardware and Software How Computers Store Data
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Tutorial 10: Programming with javascript
Python fundamental.
Presentation transcript:

INTRODUCING OUR LANGUAGE: C# CHAPTER 17 1

Topics  The Features of C# –C# is a Compiled Language –C# is Managed Code –C# is Strongly Typed –C# is Function Based –C# is Object-Oriented  Reading and Understanding C# Syntax 2

Understanding the Features of C#  C# is a Compiled Language –Computer chips only understand machine language This is what punch cards were –Authoring languages were created to be an intermediary language between humans and computers –Two kinds of authoring languages: Interpreted Compiled 3

Understanding the Features of C#  Interpreted Languages –e.g., JavaScript, PHP, and Python –Two-Step Process Programmer writes the code An interpreter converts the code into machine language in real-time –Benefits Portability: Can run on any kind of computer as long as there's an interpreter –Detriments Lack of Speed: The processing power used to interpret the code is not spent on the game itself Lack of Efficiency: Because the code can run on any computer, it's not optimized for any specific computer 4

Understanding the Features of C#  Compiled Languages –e.g., C#, Basic, Java, C++ –Three-Step Process Programmer writes the code Programmer uses a compiler to convert the code into machine language Computer executes the code –Benefits Speed: Computer spends more processor power on the game itself Efficiency: Code is optimized for a specific processor architecture –Detriments Lack of Portability: Compiled for only one kind of machine Extra Compilation Step 5

Understanding the Features of C# 6 Hierarchy of Computer Languages

Understanding the Features of C#  C# is Managed Code –Computers have a limited amount of Random Access Memory (RAM) –Older compiled languages like BASIC and C++ require the programmer to manually allocate and deallocate RAM –In managed code, allocation and deallocation are handled automatically –This makes it less likely that you will accidentally claim all of the memory Doing so is known as a "memory leak" 7

VARIABLES IN COMPUTER LANGUAGES  A variable is a name that can hold a value  This concept is borrowed from algrbra –x = 5 –x + 2 = ?  Variables in computer languages can hold much more than just simple numbers –Numbers –Words, sentences, paragraphs, novels… –Images, sounds, 3D models, animations… –Functions and methods –Classes and GameObjects 8

Understanding the Features of C#  C# is Strongly Typed –In a non-strongly typed language, a variable can hold any kind of data The same variable could hold a number one moment and an animation the next –A strongly typed language restricts the type of data that can be held by any variable int x = 5;– An int x can only hold an integer number float y = 3.4f;– A float y can only hold a floating point number –Strong typing allows accurate syntax checking The compiler can check your code for correctness –Strong typing also allows robust code-completion The code editor can guess what you want to type and auto-complete 9

Understanding the Features of C#  C# is Function Based –Computer programs used to be just a series of commands –This was like giving driving directions to someone 1.From school, head north on Vermont 2.Head west on I-10 for about 7.5 miles (about 12Km) 3.At the intersection with I-405, take the 405 south for 2mi (3.2Km) 4.Take the exit for Venice Blvd. 5.Turn right onto Sawtelle Blvd. 6.My place is just north of Venice on Sawtelle. –Functional languages allow the encapsulation of commands "If you see a store on the way, please BuySomeMilk()." The BuySomeMilk() function encapsulates the many actions involved in finding and purchasing milk. 10

Understanding the Features of C#  C# is Object-Oriented –Functions and data used to be separate –Object-oriented programming introduced classes –Classes combine functions and data into a single object Variables in classes are called fields Functions in classes are called methods –This enables things like a flock of birds where each bird thinks for itself… …rather than being controlled by a single, monolithic program –Object-orientation also allows class inheritance A subclass can inherit the fields and methods of its superclass e.g., a Dog would inherit all the fields and methods of its superclass Mammal, which would in turn inherit from Animal 11

Reading and Understanding C# Syntax  All languages have syntax: 12 The dog barked at the squirrel. At the squirrel the dog barked. The dog at the squirrel. barked barked The dog at the squirrel. [Subject] [verb] [object]. [Object] [subject] [verb]. [Subject] [object]. [verb] [verb] [Subject] [object].  Only one of these sentences is correct –Only one follows the rules of syntax of the English language  The other sentences have syntax errors

Reading and Understanding C# Syntax  C# statements also have syntax rules –int x = 5; Declares a variable named x of the type int –If a statement starts with a type, the second word of the statement becomes a new variable of that type Defines the value of x to be 5 –The = is used to assign values to variables All C# statements end with a semicolon ( ; ) –A semicolon is used because the period is already used in decimal numbers 13

Reading and Understanding C# Syntax  C# statements also have syntax rules –int x = 5; –int y = x * ( 3 + x ); Declares a variable named y of the type int Adds 3 + x for a value of 8 (because x = 5) –Just as in algebra, order of operations follows parentheses first Multiplies x * 8 for a value of 40 (5 * 8 = 40) Defines the value of y to be 40 Ends with a semicolon ( ; ) 14

Reading and Understanding C# Syntax  C# statements also have syntax rules –string greeting = "Hello World!"; Declares a variable named greeting of the type string –strings can hold a series of characters like a word or novel Defines the value of greeting to be "Hello World!" –Anything between double quotes is a string literal, a value to be assigned to a string variable Ends with a semicolon ( ; ) 15

Reading and Understanding C# Syntax  C# statements also have syntax rules –string greeting = "Hello World!"; –print( greeting ); Calls the function print() –When a function is called, it executes its actions Passes the argument greeting into the function print() –Some functions take arguments: data that changes how the function acts –The print() function will print the string greeting to the Console pane in Unity –The Console pane will display "Hello World!" Ends with a semicolon ( ; ) 16

Chapter 17 – Summary  You learned important features of C# –C# is a Compiled Language –C# is Managed Code –C# is Strongly Typed –C# is Function Based –C# is Object-Oriented  You learned to read and understand some C#  In the next chapter, you'll write your first Unity C# program 17