C# Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Digital.

Slides:



Advertisements
Similar presentations
 2005 Pearson Education, Inc. All rights reserved Introduction.
Advertisements

Chapter 1: Introduction
Primitive Data Types and Operations. Introducing Programming with an Example public class ComputeArea { /** Main method */ public static void main(String[]
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
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.
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
By: Mr. Baha Hanene Chapter 3. Learning Outcomes We will cover the learning outcome 02 in this chapter i.e. Use basic data-types and input / output in.
Microsoft Visual Basic 2012 CHAPTER ONE Introduction to Visual Basic 2012 Programming.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor.
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.
Introducing Java.
A First Program Using C#
Module 1: Introduction to C# Module 2: Variables and Data Types
Primitive Data Types and Operations Identifiers, Variables, and Constants Primitive Data Types Byte, short, int, long, float, double, char, boolean Casting.
Chapter 2 Primitive Data Types and Operations F Introduce Programming with an Example  The MyInput class F Identifiers, Variables, and Constants F Primitive.
1 Chapter 2 Primitive Data Types and Operations F Introduce Programming with an Example  The MyInput class F Identifiers, Variables, and Constants F Primitive.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
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.
Computing with C# and the.NET Framework Chapter 1 An Introduction to Computing with C# ©2003, 2011 Art Gittleman.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
© 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 –
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Programming in C#. I. Introduction C# (or C-Sharp) is a programming language. C# is used to write software that runs on the.NET Framework. Although C#
CSE 1301 Lecture 2 Data Types Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Introduction to Computer Systems and the Java Programming Language.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
CPS120: Introduction to Computer Science
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
1 Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { public static void main(String[]
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Variables and Constants Objectives F To understand Identifiers, Variables, and Constants.
CPS120: Introduction to Computer Science Variables and Constants.
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
1 1 Chapter 2 Elementary Programming. 2 2 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
Microsoft Visual Basic 2015 CHAPTER ONE Introduction to Visual Basic 2015 Programming.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
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.
Chapter 6 JavaScript: Introduction to Scripting
Working with Java.
Introduction to .NET Framework
Introduction to Visual Basic 2008 Programming
Revision Lecture
Java programming lecture one
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 2 Applications and Data.
Chapter 10 Programming Fundamentals with JavaScript
Introduction to C++ Programming
مساق: خوارزميات ومبادئ البرمجة الفصل الدراسي الثاني 2016/2015
T. Jumana Abu Shmais – AOU - Riyadh
elementary programming
Chapter 2 Primitive Data Types and Operations
Presentation transcript:

C# Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Digital Media Department Politeknik Brunei

Introduction to Programs Programs Development Programming Errors Introduction to C# C# Features Compilation Types of C# Program 2 Contents 2

Visual Studio Express 2012 (IDE) A First C# Program Analyzing The Program C# identifiers Naming Identifier C# Reserved Keywords 3 Contents Cont. 3

Variables Assignment Using Value Types Variable Constant Naming Conventions 4 Contents Cont. 4

Programs – a set of instructions written to perform a specific task with a computer. Programs are stored permanently in secondary memory (e.g. on hard disk). Instruction are encoded as binary numbers (machine code). When a program is to be run, it copied (loaded) into main memory, and the CPU executes the instructions of the program. Introduction to Programs 5

Program may read data from secondary memory and input devices. Through flow-control (If-Else, Loops, do-While,etc) the program can control the order in which program instructions are executed. Program data (variables) are stored in main memory. Results are written to output devices or to secondary memory. Introduction to Programs Cont. 6

Editor - Allows the creation of a file with your program. Compiler - A program that translates the source code into machine code. Source Code – A program written in high-level language. High-level languages – English-like statements that is easy to learn and program. Programs Development 7

Interpreter – Similar to compiler but a small part of source code is translated and executed before next part is translated. Syntax – Rules of grammar and vocabulary of a language. Semantics – the meaning of something written in the language. A program can be syntactically correct but semantically incorrect. We want programs that are syntactically and semantically correct. Programs Development Cont. 8

There are few types of programming errors Compile-time error – generated when the compiler cannot resolve a problem in the source code while it is compiling. Runtime error – generated when execution of a particular code statement or function results in an error condition being set. Logic error - program may be successfully compile but does not behave as intended. Only clue to the error is production of wrong solutions. Programming Errors 9

C# (pronounced as C Sharp) is an object oriented programming language that fully supports the functionality of the.NET framework. The language name is inspired by the musical note C# which is a “step above” C/C++ C# can be used to develop windows applications, web applications using ASP.NET, web services and others. Introduction to C# 10

C# is originated by Microsoft as a response to Java Microsoft state that C# is a language with the power of C++ and the simplicity of Visual Basic. Its initial public release is in The lead designers of C# are: Anders Hejlsberg Scoot Wiltamuth Introduction to C# Cont. 11

Variables in C# are automatically initialized by the environment. Variables are type-safe Native support for the component object model (COM) and windows-based APIs. Built in versioning Restricted use of native pointers with C#, every object is automatically a COM object. C# Features 12

Compiler allows use of initialised Variables only Strong exception handling Full XML support Suited well for building Web Services The language is intended for use in developing software components suitable for deployment in distributed environments. C# Features Cont. 13

Ultimately, developing applications using C# is usually done with an Integrated development Environment (IDE) such as Visual Studio Integrated development environment (IDE) – Combines editor, compiler and other tools into a single application. We can also use csc.exe – a command line (on DOS) compiler Compilation 14

Console Applications – Stand-alone program using a command-line interface. Types of C# Program 15

Windows Applications – Stand-alone programs using a Graphical User Interface (GUI). Types of C# Program Cont. 16

Silverlight Applications – a cross-platform next generation.NET based media with rich interactive applications for the Web. Types of C# Program Cont. 17

ASP.NET Web Applications – are Web applications displayed in a Web browser, instead of on a console or in a forms application. Types of C# Program Cont. 18

ASP.NET Web Service Applications – to create services that can be accessed by using URLs, HTTP, and XML. Types of C# Program Cont. 19

Smart Device Applications – use to create applications that run on mobile devices, such as PDAs and Smartphones. Smart device applications can be console applications, Windows Forms applications, or in a Web browser. Types of C# Program Cont. 20

Visual Studio Express 2012 (IDE) 21

A First C# Program 22 Class name Main method Comments String

The first thing to note about C# is that it is case- sensitive. You will therefore get compiler errors if, for instance, you write console rather than Console. The second thing to note is that every statement finishes with a semicolon ( ; ) or else takes a code block within curly braces ( { ). A First C# Program Cont. 23

Line 7-10 These lines are comments and ignored by the compiler  Comments helps programmers to communicate and understand the program. Line 7 is a single line comment preceded by two slashes ( // ) Line 8-10 are multiple line comments enclosed between /* and */ on one or several lines. Analyzing The Program Cont. 24

Identifiers are names used to denote variables, constants, types, methods, objects, and so on. An identifier begins with a letter or an underscore and ends with the character just before the next white space. C# identifiers are case sensitive. For example, three variables myVar, MyVar and MYVAR are all different. C# Identifiers 25

Before you can use a variable in a program, you must declare it which means you must give a name (identifier) to it and how much space to use. For example: int age; Rules to follow when naming an identifier: The name must start with a letter or an underscore. After the first letter or underscore, the name can have letters, digits, and/or underscores. Naming Identifier 26 Type Identifier

The name must not have any special characters other than the underscore. The name cannot have a space. Note that C# is case sensitive. It cannot be true, false or null Avoid using C# reserved keywords. Naming Identifier Cont. 27

Example If the rules are not obeyed, the compiler will report a syntax error. Naming Identifier Cont. 28 Allowable NamesIllegal names amountPaidreturn pay pay heightOfBox

C# Reserved Keywords 29 abstractconstexternintoutshorttypeof ascontinuefalseinterfaceoverridesizeofuint base decima l finallyinternalparamsstackalloculong booldefaultfixedisprivatestaticunchecked breakdelegatefloatlockprotectedstringunsafe bytedoforlongpublicstructushort casedoubleforeachnamespacereadonlyswitchusing catchelsegotonewrefthisvirtual charenumifnullreturnthrowvoid checkedeventimplicitobjectsbytetruevolatile classexplicitinoperatorsealedtrywhile getpartialsetvaluewhereyield

Variables are simply storage location for data. Data can be placed into the variables and retrieve their contents as part of a C# expression. The interpretation of the data in a variable is controlled through Data Types. Variables 30

The syntax for declaring a variable: datatype variableName ; Example Variables Cont. 31 int x; //Declare x to be an integer variable double radius; //Declare radius to be a double variable double interestRate; //Declare interestRate to be a double variable. char a;//Declare a to be a character variable

If the variables are of the same type, they can be declared together, separated by commas: datatype variable1, variable2,…variableN; Example: Note that variable names are in lowercase. If a name consists of several words, concatenate all of them and capitalize the first letter of each word except the first. For example: interestRate Cont. Variables 32 int i, j, k;//Declare i, j, k as integer variables

A constant is a value that never changes. To create a constant, type the const keyword to its left. When declaring a constant, you must initialize it with an appropriate value. The syntax for declaring a constant: const datatype CONSTANTNAME = VALUE; Example: const double PI = 3.142; Constant 33

By convention, constants are named in uppercase. E.g. PI, Not pi or Pi Benefits of using constants: Do not have to repeatedly type the same value. The value can be changed in a single location if necessary. A descriptive name for a constant makes the program easy to read. Constant value cannot be accidentally reassign. Cont. Constants 34

Select descriptive names with straightforward meanings for variables, constants, classes and methods. Names are case-sensitive. Use lowercase for variables and methods. If a name consists of several words, concatenate them into one, making the first word lowercase and capitalizing the first letter of each subsequent word. Naming Conventions 35

Capitalize the first letter of each word in a classname. E.g. the class names ComputeArea, Math and HelloWorld. Capitalize every letter in a constant, and use underscores between words. E.g. the constants PI and MAX_VALUE. Cont. Naming Conventions 36

Contact For Tutorial and Notes Cikguhadi.com Digital Media Department Politeknik Brunei Welcome to WADT