bil527 – bilgisayar programlama i

51
BIL527 – Bilgisayar Programlama I Introduction 1

Upload: nerita

Post on 14-Feb-2016

47 views

Category:

Documents


0 download

DESCRIPTION

BIL527 – Bilgisayar Programlama I. Introduction. Contents. Information about the course Visual Studio 20 1 2 IDE Creating Applications Console Application Windows Forms Application ASP.NET Web Page C# and the .NET Framework. Course Information. About the course. Course Contents. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: BIL527 – Bilgisayar Programlama I

BIL527 – Bilgisayar Programlama I

Introduction

1

Page 2: BIL527 – Bilgisayar Programlama I

Contents

• Information about the course• Visual Studio 2012 IDE• Creating Applications– Console Application– Windows Forms Application– ASP.NET Web Page

• C# and the .NET Framework

2

Page 3: BIL527 – Bilgisayar Programlama I

Course Information

3

Page 4: BIL527 – Bilgisayar Programlama I

About the courseLecturer: Muzaffer DOĞAN

Office Phone: 6562

E-mail Address: [email protected]

Web Page: http://ceng.anadolu.edu.tr/muzafferd/

Teaching Assistant: ---

Course Web Page: http://ceng.anadolu.edu.tr/Ders.aspx?dersId=78

Class Hours and Location: 14:00-17:00, WED on B5

Office Hours: 14:00-17:00, FRI

Prerequisites: None

Textbooks: Beginning Microsoft Visual C# 2012, Karli Watson, Christian Nagel et al., Wiley Publishing, 2012.Illustrated C# 2012, Daniel Solis, Apress, 2012.

4

Page 5: BIL527 – Bilgisayar Programlama I

Course ContentsWeek 1 Visual Studio 2012 IDE, C# and the .NET Framework, Creating

Console Applications, Windows Forms Projects, and ASP.NET Web Pages

Week 2 Comments, Variables, Expressions, Operators, Namespaces

Week 3 Flow Control, Binary Operators, Loops, Arrays

Week 4 Type Conversions, Enumerations, Structs, Arrays

Week 5 String Operations, Functions, Delegates

Week 6 First Midterm

5

Page 6: BIL527 – Bilgisayar Programlama I

Course Contents (continued)Week 7 Debugging, Exception Handling

Week 8 Object-Oriented Programming, Interfaces, Properties

Week 9 Collections, Indexers, Iterators, Operator Overloading

Week 10 Sorting, Generics, Events

Week 11 Second Midterm

Week 12 File Operations

Week 13 Asynchronous Programming

Week 14 Final Exam

6

Page 7: BIL527 – Bilgisayar Programlama I

Grading Plan

• 1st MT: 20%, 2nd MT: 20%, Homework: 20%,Final: 40%.

• Curve will be applied to the grades• If your grade is below 80%, you cannot get the

grade AA, but it is not certain that if you pass 80% then you get AA.

• If your grade is below 35%, you certainly fail, but this does not mean that you’ll get at least DD if you pass 35%.

7

Page 8: BIL527 – Bilgisayar Programlama I

Sample Grading Plan

Grade Letter Grade

≥ 80 AA≥ 75 AB≥ 70 BA≥ 65 BB≥ 60 BC

Grade Letter Grade

≥ 55 CB≥ 50 CC≥ 45 CD≥ 40 DC≥ 35 DD< 35 FF

8

Page 9: BIL527 – Bilgisayar Programlama I

Attendances

• You don’t have to attend the classes but recent experiences show that the students who attend the classes are more successful

• All students are responsible for visiting the website of the course at least two times in each week

• Announcements, assignments, grades, and project subjects will be published on the website.

9

Page 10: BIL527 – Bilgisayar Programlama I

Supplementary Software

• In this course, you’ll need Visual Studio 2012 software

• You can download it from a shared folder as explained in http://ceng.anadolu.edu.tr/msdn.aspx page

• You can login to the website using your Anadolu e-mail account.

• If you have problems in logging in, please inform me.

10

Page 11: BIL527 – Bilgisayar Programlama I

Setting the Visual C# Settings

11

Page 12: BIL527 – Bilgisayar Programlama I

Visual C# Keyboard Settings• After installing Visual Studio 2012, select the Visual C#

Settings from the Default Collection of Settings window.• This sets the keyboard commands and the user interface

for the C# environment.– Run: Ctrl-F5, Debug: F5, Build: Ctrl-Shift-B, etc.– New Website command in the Start Page if you select Web

Development settings.• If you miss the window, or select another setting, then

select the command Import and Export Settings from the Tools menu.

12

Page 13: BIL527 – Bilgisayar Programlama I

13

Page 14: BIL527 – Bilgisayar Programlama I

14

Page 15: BIL527 – Bilgisayar Programlama I

15

Page 16: BIL527 – Bilgisayar Programlama I

16

Page 17: BIL527 – Bilgisayar Programlama I

Creating a Console Application

17

Page 18: BIL527 – Bilgisayar Programlama I

18

Page 19: BIL527 – Bilgisayar Programlama I

19

Page 20: BIL527 – Bilgisayar Programlama I

20

Page 21: BIL527 – Bilgisayar Programlama I

21

Write the code and press Ctrl-F5

Page 22: BIL527 – Bilgisayar Programlama I

22

Page 23: BIL527 – Bilgisayar Programlama I

Creating a Windows Forms Application

23

Page 24: BIL527 – Bilgisayar Programlama I

24

Page 25: BIL527 – Bilgisayar Programlama I

25

Page 26: BIL527 – Bilgisayar Programlama I

26

Drag & drop a label and button onto the form

Page 27: BIL527 – Bilgisayar Programlama I

27

Double-click the button

Page 28: BIL527 – Bilgisayar Programlama I

28

Write the code and press Ctrl-F5

Page 29: BIL527 – Bilgisayar Programlama I

29

Click the button

Page 30: BIL527 – Bilgisayar Programlama I

Creating an ASP.NET Web Page

30

Page 31: BIL527 – Bilgisayar Programlama I

31

Do NOT select File -> New ->

Project -> ASP.NET Web

Forms Application

Page 32: BIL527 – Bilgisayar Programlama I

32

Page 33: BIL527 – Bilgisayar Programlama I

33

Right-click the project name and select Add -> Add New Item

(equivalently: Add -> Web Form)

Page 34: BIL527 – Bilgisayar Programlama I

34

Page 35: BIL527 – Bilgisayar Programlama I

35

Switch to Design View

Page 36: BIL527 – Bilgisayar Programlama I

36

Put a Label, press the Enter key, and put a Button

Page 37: BIL527 – Bilgisayar Programlama I

37

Double-click the button

Page 38: BIL527 – Bilgisayar Programlama I

38

Write the code and press Ctrl-F5

Page 39: BIL527 – Bilgisayar Programlama I

39

Click the button

Page 40: BIL527 – Bilgisayar Programlama I

40

Page 41: BIL527 – Bilgisayar Programlama I

Conclusion

• You can use C# to create several types of applications

• Creating a Windows Forms Application and an ASP.NET Application are similar

• You can also create mobile applications in C# (for only Windows Mobile devices)

• You can use a powerful IDE, Visual Studio 2012, to develop applications (Express editon of Visual Studio is free of charge)

41

Page 42: BIL527 – Bilgisayar Programlama I

.NET Framework

• Microsoft’s platform to develop applications• It may run on several operating systems– Mono on Linux and Mac OS– .NET Compact Framework on PDAs and smartphones

• It supports several types of applications– Windows applications, web applications, web

services, mobile applications, etc.• It supports several programming languages– C#, C++, Visual Basic, Jscript, COBOL, Java, Delphi, etc.

42

Page 43: BIL527 – Bilgisayar Programlama I

What’s in the .NET Framework

• Library of codes that you use from your client language (C#, VB, etc.) using OOP techniques

• .NET Common Language Runtime (CLR) executes .NET applications (similar to JRE)

• The codes are compiled into Common Intermediate Language (CIL) codes (like .class files in Java)– CIL codes are independent of the OS

• Just-in-time (JIT) compiler compiles the CIL codes to native code of the OS– JIT compiler compiles the CIL codes only when it is needed

43

Page 44: BIL527 – Bilgisayar Programlama I

Managed Code

• Code written using the .NET Framework is managed

• It means that the CLR looks after your applications by managing memory, handling security, etc.

• In C#, you can write only managed codes• In C++, you can write both managed and

unmanaged codes

44

Page 45: BIL527 – Bilgisayar Programlama I

Garbage Collection

• In unmanaged codes, the programmer have to manage the memory so that all allocated memory spaces are freed at the end of the program

• But in managed codes, memory allocation and deallocation are managed by the CLR. This concept is called garbage collection

• .NET garbage collection works periodically and deallocates memory spaces that are no longer needed

45

Page 46: BIL527 – Bilgisayar Programlama I

C#

• An evolution of the C and C++ languages• Created by Microsoft specifically to work with

the .NET platform• Designed to incorporate many of the best

features from other languages, while clearing up their problems

46

Page 47: BIL527 – Bilgisayar Programlama I

Visual Studio 2012• A powerful integrated development environment (IDE)• Automates the steps required to compile source code• Intelligently detect errors and suggest code where

appropriate as you are typing (Intellisense)• Includes designers, enabling simple drag&drop design of

UI elements• Includes starter projects• Enables deployment• Enables debugging• etc.

47

Page 48: BIL527 – Bilgisayar Programlama I

Visual Studio Versions

• Visual Studio Professional• Visual Studio Premium• Visual Studio Ultimate• Visual Studio Express Edition: Free, but some

features are absent• Visual C# Express: Contains only C#• Visual Web Developer Express: Contains only

web application tools

48

Page 49: BIL527 – Bilgisayar Programlama I

Visual Studio Solutions

• You create solutions in Visual Studio• Solutions contain projects• Solutions can contain multiple projects– This enables you to work on shared code

49

Page 50: BIL527 – Bilgisayar Programlama I

50

Solution Explorer

Properties Window

Toolbox Designer

Page 51: BIL527 – Bilgisayar Programlama I

51

Source Code

SolutionProjectSource

Files