Windows Programming Overview Yingcai Xiao What is a

  • Slides: 44
Download presentation
Windows Programming Overview Yingcai Xiao

Windows Programming Overview Yingcai Xiao

What is a Computer? From the Webster’s New World Dictionary: 1. A person who

What is a Computer? From the Webster’s New World Dictionary: 1. A person who computes. 2. A device used for computing (an electronic machine which by means of stored instructions and information, perform rapid, often complex calculations or compiles, correlates, and selects data).

What is a program and what is programming? Programs: stored computer instructions for data

What is a program and what is programming? Programs: stored computer instructions for data processing. Programming = Data Structures + Algorithms Professor Donald E. Knuth http: //www-cs-faculty. stanford. edu/~knuth/

What is Windows Programming? Windows Programming: Programming for the Windows platform? Programming on the

What is Windows Programming? Windows Programming: Programming for the Windows platform? Programming on the Windows platform!

What Types of Programs? Programs to be covered in this class: (1) Windows: CLI

What Types of Programs? Programs to be covered in this class: (1) Windows: CLI (Command Line Interface) GUI (Graphical User Interface) NUI (Natural User Interface) (2) Web: Server Side, Web Applications, 3 -Tir Enterprise Applications, Web Services (3) Cloud: Applications on the Cloud.

What Programming Tools? C# &. NET C#: (0) C^(+)^(2 n); n = 0, 1,

What Programming Tools? C# &. NET C#: (0) C^(+)^(2 n); n = 0, 1, 2, => C, C++, C# (1) The most advanced programming language to date (3) OOP (Object-oriented Programming) (4) EDP (Event Driven Programming) (5) Dynamic type generation (6) Platform-independent? : Code runs on any platform with. NET runtime (7) Visual Studio 2012

Our Approach • Principles and practices: know the concepts and know how to design

Our Approach • Principles and practices: know the concepts and know how to design and implement an application. • Inside and Out: how does it work inside (under the hood), how to design a system (the big picture). • Gradual: starting from the fundamentals and add new features as we move ahead.

System Support Integrated Development Platform (IDE): Microsoft Visual Studio 2012 (Web) From Microsoft Imagine

System Support Integrated Development Platform (IDE): Microsoft Visual Studio 2012 (Web) From Microsoft Imagine (free downloads) The lab computers: CAS 241 and 254 With Microsoft Visual Studio 2012 Server for the course: winverv 1. cs. uakron. edu With Microsoft Visual Studio 2012 Windows Server

An Introduction to C# and. NET

An Introduction to C# and. NET

What is. NET? . Net is a framework for developing OS-platform-independent, Programming-language-independent, web-enabled, distributed

What is. NET? . Net is a framework for developing OS-platform-independent, Programming-language-independent, web-enabled, distributed applications.

Traditional Compilation (Linking) Source Code for Language 1 Compiler on OS 1 Language 1

Traditional Compilation (Linking) Source Code for Language 1 Compiler on OS 1 Language 1 Compiler on OS 2 Binary Code for OS 1 Binary Code for OS 2 OS 1 OS 2

From Source to Binary (C++) Process Coding Products. cpp (implementations). h (UDT definitions) Purpose.

From Source to Binary (C++) Process Coding Products. cpp (implementations). h (UDT definitions) Purpose. h contains definitions of all UDT(User Defined Data Types): struct , class , enum , templates, #define (preprocessor directives) , encapsulation Notes Timer. h: #define PI 3. 14 class Timer {int t; set. Timer(int t); }; Timer. cpp Timer: : set. Timer(int t){this. t=t; } Preprocessing . I. pch. ipch . I =. cpp with the contents of all. h files added, white spaces removed, preprocessor directives resolved, all PI's replaced with 3. 14. pch is large (in MBs). pch -> precompiled header (preprocessed commonly used headers) , . ipch -> intellisense pch Compilation . obj Resolve templates, check syntax, verify types, Syntax errors reported to the generate machine/binary code. programmer. Linking Loading Running Link all object files together, create executables , static libraries, dynamic linked. exe. lib. dll libraries (shared by all programs on the system). Load program into memory (RAM) : process (in memory stack->static (per PID); heap->dynamic (per running program) / system/resolved at run-time) ; text->binary PID code. Point PC to the entry point in code: main; Moving execute instruction code one statement at a PC time. (program counter) Static linked lib and exe are large: all machine code are copied in, no sharing. int i; // static on the stack new int; // dynamic on the heap set. Timer // an address in the code/text PC jumps to set. Timer when the method is called; Return sets the PC back to the caller.

Common Binary Code?

Common Binary Code?

OS-Independent Code: Intermediate Languages The trend to support OS-independent binary code is to compile

OS-Independent Code: Intermediate Languages The trend to support OS-independent binary code is to compile the source code into the binary format of an intermediate language. And to provide an interpreter for the intermediate language on each OS to translate the binary code of the intermediate language into the native binary code of the OS.

OS-Independent Compilation: Intermediate Language Source Code for Language 1 Compiler on OS 1 Language

OS-Independent Compilation: Intermediate Language Source Code for Language 1 Compiler on OS 1 Language 1 Compiler on OS 2 Intermediate Binary Code Intermediate Code Interpreter OS 1 Intermediate Code Interpreter OS 2 Binary Code for OS 1 Binary Code for OS 2 OS 1 OS 2

Java Intermediate Language: Java Bytecode Java Source Code (. java) Java Compiler (javac) on

Java Intermediate Language: Java Bytecode Java Source Code (. java) Java Compiler (javac) on OS 1 Java Compiler (javac) on OS 2 Java Bytecode (. class) Java Interpreter on OS 1 (java) Java Interpreter on OS 2 (java) Binary Code for OS 1 Binary Code for OS 2 OS 1 OS 2 Program statements are interpreted one at a time during the run-time.

JIT Compiler An interpreter interprets intermediate code one line at a time. Slow execution.

JIT Compiler An interpreter interprets intermediate code one line at a time. Slow execution. A JIT (Just-In-Time) Compiler compiles the complete code all at once just into native binary code before execution. Faster execution.

JIT Complier: Java Bytecode Compiler Java Source Code (. java) Java Compiler (javac) on

JIT Complier: Java Bytecode Compiler Java Source Code (. java) Java Compiler (javac) on OS 1 Java Compiler (javac) on OS 2 Java Bytecode (. class) Java JIT Compiler on OS 1 Java JIT Compiler on OS 2 Binary Code for OS 1 Binary Code for OS 2 OS 1 OS 2 All programming statements are compiled at compile time.

MSIL: Microsoft Intermediate Language Source Code for Language 1 Compiler on OS 1 Language

MSIL: Microsoft Intermediate Language Source Code for Language 1 Compiler on OS 1 Language 1 Compiler on OS 2 MSIL Code MSIL JIT Compiler on OS 1 MSIL JIT Compiler on OS 2 Binary Code for OS 1 Binary Code for OS 2 OS 1 OS 2 . NET OS-Platform-Independence

A Common Language?

A Common Language?

. NET Common Language Runtime To make. NET language independent, CLR (Common Language Runtime)

. NET Common Language Runtime To make. NET language independent, CLR (Common Language Runtime) is defined as the runtime environment. CLR defines CTS (Common Type System) which should be followed by all languages to be used in the. NET framework. Syntax: int, for, …, struct, class, Semantics: multiple inheritance not allowed in CTS Object Oriented: encapsulation, inheritance and polymorphism Visual Basic (. Net) redesigned to be OO The code that follows CTS standard is called managed code. regular C++ supports multiple inheritance managed C++ does not support multiple inheritance

CLR: Common Language Runtime Source Code for Language 1 Source Code for Language 2

CLR: Common Language Runtime Source Code for Language 1 Source Code for Language 2 Language 1 Compiler on OS 1 Language 2 Compiler on OS 2 MSIL Code Confirming CTS (Managed Code) CLR on OS 1 CLR on OS 2 Binary Code for OS 1 Binary Code for OS 2 OS 1 OS 2 . NET Language-Independence

. NET Architecture for Language and Platform Independence (fan-in and fan-out on MSIL) Source

. NET Architecture for Language and Platform Independence (fan-in and fan-out on MSIL) Source Code for Language 1 Source Code for Language 2 Language 1 Compiler on OS 1 Language 2 Compiler on OS 2 MSIL Code Confirming CTS (Managed Code) CLR on OS 1 CLR on OS 2 Binary Code for OS 1 Binary Code for OS 2 OS 1 OS 2

CLI (Common Language Infrastructure) CLR/CTS for Everyone?

CLI (Common Language Infrastructure) CLR/CTS for Everyone?

CLI : Common Language Infrastructure A specification defines an environment for multiple high-level languages

CLI : Common Language Infrastructure A specification defines an environment for multiple high-level languages to be used on different computer platforms. Created by Microsoft based on. NET, standardized by MS, Intel, HP and others, ratified by ECMA and ISO. . NET is an implementation of CLI for desktop systems. . NET Compact Framework is an implementation of CLI for portable devices. Open Source implementations: Mono development platform (Novell), Portable. NET (dot. GNU)

CLI (Common Language Infrastructure) Specification Open Architecture for Language and Platform Independent Programming Source

CLI (Common Language Infrastructure) Specification Open Architecture for Language and Platform Independent Programming Source Code for Language 1 Source Code for Language 2 Language 1 Compiler on OS 1 Language 2 Compiler on OS 2 CIL (Common Intermediate Language) Code Confirming CTS (Common Type System) CLR for OS 1 CLR for OS 2 Binary Code for OS 1 Binary Code for OS 2 OS 1 OS 2

Even though, CLI/CTS/CLR can make a program written in any language to run on

Even though, CLI/CTS/CLR can make a program written in any language to run on any platform, the entire program (including all libraries used) has to be on the platform before running. Can we have part of a program on one computer and another part of the same program on another computer? Distributed Computing. A program is divided into multiple parts and different parts are distribute on different computers. e. g. remote surgery.

Web Enabled & Distributed. NET

Web Enabled & Distributed. NET

. Net is Web-enabled and Distributed To run distributed code on the web, we

. Net is Web-enabled and Distributed To run distributed code on the web, we need a standardized way to register and access the code. Registration: UDDI Registry: Universal Description, Discovery, and Integration. Access: SOAP: Simple Object Access Protocol WSDL: Web Service Description Language

A Common Language for the Internet (free of compilation and translation)?

A Common Language for the Internet (free of compilation and translation)?

A Common Language for the Internet • • Tim Berners-Lee, Director of WWW Consortium

A Common Language for the Internet • • Tim Berners-Lee, Director of WWW Consortium CERN : Center for European Particle Research ASCII text (ISO/IEC 8859 -1) is platform-independent. HTTP (Hyper Text Transport Protocol) e. g. GET wp. html Assembly Language for the Internet HTML (Hyper Text Markup Language) High-level language for the Internet) hyper text: text that describes other text tags: type definition of text in text <title>WP</title> all tags are predefined in HTML only system defined types, no user defined types Recognizable by all types of computers. (World Wide Web)

A Common Language for the Internet Þ HTTP: Communication protocol between client and server.

A Common Language for the Internet Þ HTTP: Communication protocol between client and server. Þ HTML: Common language for the WWW Interpreted by web browsers Þ HTML 5: <video>, <audio>, <canvas>, SVG, Math. ML https: //www. khronos. org/webgl/wiki/Tutorial https: //en. wikipedia. org/wiki/HTML 5 https: //www. w 3. org/TR/html 5/

A Common Language for the Internet ÞXML (e. Xtensible Markup Language) Allow user defined

A Common Language for the Internet ÞXML (e. Xtensible Markup Language) Allow user defined tags (types) ÞSOAP (Simple Object Access Protocol) Standards for defining objects for the Internet Based on XML ÞWSDL (Web Service Description Language) Standards for describing web services for the Internet Based on XML

. NET Architecture for Web-based Distributed Computing Client 1 UDDI Registry 2 SOAP Client

. NET Architecture for Web-based Distributed Computing Client 1 UDDI Registry 2 SOAP Client 2 Web Service 1 UDDI Registry 1 WSDL Interface 1 Web Service 2 WEB SOAP WSDL Interface 2

. NET Framework Composition http: //en. wikipedia. org/wiki/. NET_Framework

. NET Framework Composition http: //en. wikipedia. org/wiki/. NET_Framework

. NET Framework Compositions Common Language Runtime (CLR ): provides the runtime environment for

. NET Framework Compositions Common Language Runtime (CLR ): provides the runtime environment for MSIL code. Framework Class Library (FCL) : provides standard libraries for developing common. Net applications. . NET runtime environment comes with Windows. NET development environment comes with Visual Studio

. NET Framework Compositions Framework 4. 5 supported by VS 2012 Framework 4. 0

. NET Framework Compositions Framework 4. 5 supported by VS 2012 Framework 4. 0 supported by VS 2010 All on Intel x 86 CPUs ARM (Advanced RISC Machine) supports 4. 5 SIMD (single instruction, multiple data), multi and many core processors. Some support through Direct 3 D. No support yet for SSE (Streaming SIMD Extensions to x 86)

. Net Framework Class Library System Windows Web Data (Database) Forms (GUI) UI Services

. Net Framework Class Library System Windows Web Data (Database) Forms (GUI) UI Services Enterprise Services XML String, (Data Description) … Connection Data. Set Xml. Document Language Integrated Query, Windows Presentation Foundation, Windows Communication Foundation, …

. NET Application Types Web Services Browser Local Distributed Accessible Applications Remote Applications .

. NET Application Types Web Services Browser Local Distributed Accessible Applications Remote Applications . Net Framework Class Library Common Language Runtime OS Other Applications

History: . Net & COM MFC: Microsoft Foundation Class, code reuse within an application

History: . Net & COM MFC: Microsoft Foundation Class, code reuse within an application (process) COM: Component Object Model, code reuse across applications (processes) DCOM: Distributed COM, code reuse across systems COM+: Internet-based Enterprise COM, code reuse across the Internet. NET: COM+ 2. 0, all COM+ services are available in. NET, even those not in managed code, interoperable with COM-based applications

. NET Enterprise Servers Internet Information Services (IIS): web server Commerce Server: e-commerce server

. NET Enterprise Servers Internet Information Services (IIS): web server Commerce Server: e-commerce server SQL Server: database server Exchange Server: MS exchange services Mobile Information Server: wireless server Internet Security and Acceleration (ISA) Server: firewall, proxy, … Biz. Talk: B 2 B (Business-to-Business) server

Versions of. NET 1. 0: 2002, fundamentals 2. 0: 2005, partial classes, profile object,

Versions of. NET 1. 0: 2002, fundamentals 2. 0: 2005, partial classes, profile object, ACL http: //forums. asp. net/t/1115522. aspx 3. 0: 2006, WCF (Windows Communication Foundation), WWF (Windows Workflow Foundation, WPF (Windows Presentation Foundation) http: //forums. asp. net/t/1115522. aspx 4. 0: 2010, DLR (Dynamic Language Runtime), Parallel Processing http: //msdn. microsoft. com/en-us/library/ms 171868. aspx 5. 0: 2020, Based on. NET Core (Open Source), Cross Platforms (PC, Phone, Browser, Embedded, Io. T, …),

Versions of. NET http: //en. wikipedia. org/wiki/. NET_Framework#mediaviewe r/File: Dot. Net. svg

Versions of. NET http: //en. wikipedia. org/wiki/. NET_Framework#mediaviewe r/File: Dot. Net. svg

Summary • • Computer Programming Windows Programming Tools Source Code => Binary Code Cross-platform

Summary • • Computer Programming Windows Programming Tools Source Code => Binary Code Cross-platform Binary Code Reuse (CIL, CLR) Distributed Computing WWW/HTML 5. NET Components and Versions