0
Introduction toProgrammingCreating and RunningYour First C# ProgramSvetlin NakovTelerik Corporationwww.telerik.com
Table of Contents1. What is Computer Programming?2. Your First C# Program3. What is .NET Framework?4. What isVisual Studio...
What is ComputerProgramming?
Define: Computer ProgrammingComputer programming: creating asequence of instructions to enable thecomputer to do something...
Programming Phases Define a task/problem Plan your solution Find suitable algorithm to solve it Find suitable data str...
Your First C# Program
First Look at C#Sample C# program:using System;class HelloCSharp{static void Main(){Console.WriteLine("Hello, C#");}}7
C# Code – How It Works?using System;class HelloCSharp{static void Main(){Console.WriteLine("Hello, C#");}}Include the stan...
C# Code Should BeWell Formattedusing System;class HelloCSharp{static void Main(){Console.WriteLine("Hello, C#");}}The { sy...
Example of Bad FormattingusingSystem;class HelloCSharp {staticvoid Main( ) { Console. WriteLine ("Hello, C#" ) ;Console.Wr...
What is "C#"? Programming language A syntax that allow to give instructions to thecomputer C# features: New cutting ed...
WhatYou Need to Program? Knowledge of a programming language C# Task to solve Development environment, compilers, SDK...
Your First C# ProgramLive Demo
What is .NETFramework?
What is .NET Framework? Environment for execution of .NET programs Powerful library of classes Programming model Commo...
Operating System (OS)Common Language Runtime (CLR)Base Class Library (BCL)ADO.NET, LINQ and XML (DataTier)WCF and WWF (Com...
CLR –The Heart of .NETFramework Common Language Runtime (CLR) Managed execution environment Executes .NET applications...
Framework Class Library Framework Class Library (FCL) Provides basic functionality to developers: Console applications...
What isVisual Studio?
Visual Studio Visual Studio – Integrated DevelopmentEnvironment (IDE) Development tool that helps us to: Write code De...
Benefits ofVisual Studio Single tool for: Writing code in many languages (C#,VB, …) Using different technologies (Web,W...
Visual Studio – Example22
Visual StudioCompiling, Running and Debugging C# Programs
Creating New Console Application1. File  New  Project ...2. Choose C# console application3. Choose project directory and...
Creating New Console Application (2)4. Visual Studio creates some source code for youNamespacenot requiredClass nameshould...
Compiling Source Code The process of compiling includes: Syntactic checks Type safety checks Translation of the source...
Running Programs The process of running application includes: Compiling (if project not compiled) Starting the applicat...
DebuggingThe Code The process of debuggingapplication includes: Spotting an error Finding the lines of code thatcause t...
Debugging inVisual Studio Visual Studio has built-in debugger It provides: Breakpoints Ability to trace the code execu...
Visual StudioCompiling, Running and Debugging C# ProgramsLive Demo
Visual StudioBlank SolutionCreating a SolutionWithout Projects
What Is a Blank Solution? AVisual Studio blank solution Solution with no projects in it Projects to be added later Wha...
VS Blank Solution33
Visual StudioBlank SolutionLive Demo
What is MSDNLibrary?
What is MSDN Library? Complete documentation of all classes andtheir functionality With descriptions of all methods, pro...
MSDN Library37
How to Use MSDN Library? Offline version Use the table of contents Use the alphabetical index Search for phrase or key...
MSDN LibraryBrowsing and Searching DocumentationLive Demo
Introduction to ProgrammingQuestions?http://academy.telerik.com
Exercises1. Familiarize yourself with: MicrosoftVisual Studio Microsoft Developer Network (MSDN) LibraryDocumentation F...
Exercises (2)5. Install at home:1. Microsoft .NET Framework2. MicrosoftVisual Studio (orVisual C# Express)3. Microsoft Dev...
Exercises (3)9. Write a program that prints the first 10 members ofthe sequence: 2, -3, 4, -5, 6, -7, ...10. Provide a sho...
Upcoming SlideShare
Loading in...5
×

01. introduction to-programming

353

Published on

01. Introduction to Programming

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
353
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
31
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "01. introduction to-programming"

  1. 1. Introduction toProgrammingCreating and RunningYour First C# ProgramSvetlin NakovTelerik Corporationwww.telerik.com
  2. 2. Table of Contents1. What is Computer Programming?2. Your First C# Program3. What is .NET Framework?4. What isVisual Studio?5. What is MSDN Library?2
  3. 3. What is ComputerProgramming?
  4. 4. Define: Computer ProgrammingComputer programming: creating asequence of instructions to enable thecomputer to do somethingDefinition by Google4
  5. 5. Programming Phases Define a task/problem Plan your solution Find suitable algorithm to solve it Find suitable data structures to use Write code Fix program error (bugs) Make your customer happy= Specification= Design= Implementation=Testing & Debugging= Deployment5
  6. 6. Your First C# Program
  7. 7. First Look at C#Sample C# program:using System;class HelloCSharp{static void Main(){Console.WriteLine("Hello, C#");}}7
  8. 8. C# Code – How It Works?using System;class HelloCSharp{static void Main(){Console.WriteLine("Hello, C#");}}Include the standardnamespace "System"Define a class called"HelloCSharp"Define the Main()method – theprogram entry pointPrint a text on the console bycalling the method "WriteLine"of the class "Console"8
  9. 9. C# Code Should BeWell Formattedusing System;class HelloCSharp{static void Main(){Console.WriteLine("Hello, C#");}}The { symbol shouldbe alone on a new line.The block after the{ symbol should beindented by a TAB.The } symbol shouldbe under thecorresponding {.Class names should use PascalCaseand start with a CAPITAL letter.9
  10. 10. Example of Bad FormattingusingSystem;class HelloCSharp {staticvoid Main( ) { Console. WriteLine ("Hello, C#" ) ;Console.WriteLine ( "Hello again") ;}}Such formattingmakes the sourcecode unreadable.10
  11. 11. What is "C#"? Programming language A syntax that allow to give instructions to thecomputer C# features: New cutting edge language Extremely powerful Easy to learn Easy to read and understand Object-oriented11
  12. 12. WhatYou Need to Program? Knowledge of a programming language C# Task to solve Development environment, compilers, SDK Visual Studio, .NET Framework SDK Set of useful standard classes Microsoft .NET Framework FCL Help documentation MSDN Library12
  13. 13. Your First C# ProgramLive Demo
  14. 14. What is .NETFramework?
  15. 15. What is .NET Framework? Environment for execution of .NET programs Powerful library of classes Programming model Common execution engine for manyprogramming languages C# Visual Basic .NET Managed C++ ... and many others15
  16. 16. Operating System (OS)Common Language Runtime (CLR)Base Class Library (BCL)ADO.NET, LINQ and XML (DataTier)WCF and WWF (Communication and WorkflowTier)ASP.NETWeb Forms, MVC, AJAXMobile InternetToolkitWindowsFormsWPF SilverlightC# C++ VB.NET J# F# JScript Perl Delphi …Inside .NET Framework Building blocks of .NET FrameworkFCLCLR16
  17. 17. CLR –The Heart of .NETFramework Common Language Runtime (CLR) Managed execution environment Executes .NET applications Controls the execution process Automatic memory management (garbagecollection) Programming languages integration Multiple versions support for assemblies Integrated type safety and securityCLR17
  18. 18. Framework Class Library Framework Class Library (FCL) Provides basic functionality to developers: Console applications WPF and Silverlight rich-media applications Windows Forms GUI applications Web applications (dynamic Web sites) Web services, communication and workflow Server & desktop applications Applications for mobile devices18
  19. 19. What isVisual Studio?
  20. 20. Visual Studio Visual Studio – Integrated DevelopmentEnvironment (IDE) Development tool that helps us to: Write code Design user interface Compile code Execute / test / debug applications Browse the help Manage projects files20
  21. 21. Benefits ofVisual Studio Single tool for: Writing code in many languages (C#,VB, …) Using different technologies (Web,WPF, …) For different platforms (.NET CF, Silverlight, …) Full integration of most development activities(coding, compiling, testing, debugging,deployment, version control, ...) Very easy to use!21
  22. 22. Visual Studio – Example22
  23. 23. Visual StudioCompiling, Running and Debugging C# Programs
  24. 24. Creating New Console Application1. File  New  Project ...2. Choose C# console application3. Choose project directory and name24
  25. 25. Creating New Console Application (2)4. Visual Studio creates some source code for youNamespacenot requiredClass nameshould bechangedSome importsare not required25
  26. 26. Compiling Source Code The process of compiling includes: Syntactic checks Type safety checks Translation of the source code to lower levellanguage (MSIL) Creating of executable files (assemblies) You can start compilation by Using Build->Build Solution/Project Pressing [F6] or [Shift+Ctrl+B]26
  27. 27. Running Programs The process of running application includes: Compiling (if project not compiled) Starting the application You can run application by: Using Debug->Start menu By pressing [F5] or [Ctrl+F5]* NOTE: Not all types of projects are able to bestarted!27
  28. 28. DebuggingThe Code The process of debuggingapplication includes: Spotting an error Finding the lines of code thatcause the error Fixing the code Testing to check if the error isgone and no errors are introduced Iterative and continuous process28
  29. 29. Debugging inVisual Studio Visual Studio has built-in debugger It provides: Breakpoints Ability to trace the code execution Ability to inspect variables at runtime29
  30. 30. Visual StudioCompiling, Running and Debugging C# ProgramsLive Demo
  31. 31. Visual StudioBlank SolutionCreating a SolutionWithout Projects
  32. 32. What Is a Blank Solution? AVisual Studio blank solution Solution with no projects in it Projects to be added later What is the point? Not making a project just to give proper name And not working in this project
  33. 33. VS Blank Solution33
  34. 34. Visual StudioBlank SolutionLive Demo
  35. 35. What is MSDNLibrary?
  36. 36. What is MSDN Library? Complete documentation of all classes andtheir functionality With descriptions of all methods, properties,events, etc. With code examples Related articles Library of samples Use local copy or theWeb version athttp://msdn.microsoft.com/36
  37. 37. MSDN Library37
  38. 38. How to Use MSDN Library? Offline version Use the table of contents Use the alphabetical index Search for phrase or keyword Filter by technology Browse your favorite articles Online version Use the built-in search38
  39. 39. MSDN LibraryBrowsing and Searching DocumentationLive Demo
  40. 40. Introduction to ProgrammingQuestions?http://academy.telerik.com
  41. 41. Exercises1. Familiarize yourself with: MicrosoftVisual Studio Microsoft Developer Network (MSDN) LibraryDocumentation Find information about Console.WriteLine() method.2. Create, compile and run a “Hello C#” consoleapplication.3. Modify the application to print your name.4. Write a program to print the numbers 1, 101 and1001.41
  42. 42. Exercises (2)5. Install at home:1. Microsoft .NET Framework2. MicrosoftVisual Studio (orVisual C# Express)3. Microsoft Developer Network (MSDN)6. Create console application that prints your first andlast name.7. Create a console application that prints the currentdate and time.8. Create a console application that calculates andprints the square of the number 12345.42
  43. 43. Exercises (3)9. Write a program that prints the first 10 members ofthe sequence: 2, -3, 4, -5, 6, -7, ...10. Provide a short list with information about the mostpopular programming languages. How do they differfrom C#?11. Describe the difference between C# and .NETFramework.12. *Write a program to read your age from the consoleand print how old you will be after 10 years.*NOTE: If you have any difficulties, search in Google.43
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×