Presentation is loading. Please wait.

Presentation is loading. Please wait.

IS 135 Business Programming

Similar presentations


Presentation on theme: "IS 135 Business Programming"— Presentation transcript:

1 IS 135 Business Programming
.NET and Visual Studio IS 135 Business Programming

2 .NET Framework The most recent MS announcement
An attempt to enter the “enterprise” arena Good programmer tools Excellent access to universal resources Will allow many languages Large Base Library for all languages

3 .NET Continued Only on Windows at the moment
However, the Intermediate Language (IL) that results from compilation is possibly machine independent This portable executable (PE) is part of the familiar .EXE file

4 .NET Continued The idea is to create programs in .NET
Compile them in the “common language runtime” (CLR)… more later The code is translated into native code Any language that is compliant will run

5 .NET Continued MS used existing concepts and improved on them to create .NET It has: robust CLR Extensive class library Internet based inter process communication Multiple languages

6 .NET Framework Operating System Web Forms WIN forms Web Services
Data Access XML Classes Base Classes .NET Framework Operating System

7 Class Library Saves you writing common routines
Contains over 2500 classes Classes contain commonly used routines like printing, display etc Available to all languages under .NET through CLR

8 .Net and C# Structure

9 Start Page

10

11 Programming Environment

12 Execution Screen

13 CLR- Simplify App Dev 2500 classes, programmer can reuse
Organizations can create their own reusable code Memory management simple with auto garbage collection

14 CLR - Performance High level languages always worse than assembler
JIT compiles method into native code first Next time it executes directly in native code Allocation of memory is next available storage Deallocation done by garbage collector

15 Why CLR? Without it, compiler has to create safety
But there are many compilers, some 3rd party All languages do not have safety features Some compiler implementations are slow

16 CLR Design Interpreter or compiler
Interpreter does work at runtime, slow Modern systems, have front-end compiler, back-end runtime

17 CLR – Intermediate Language
Front end does all checking, creates IL JIT can create reusable native code Better runtime performance

18 CLR and JVM Java Virtual Machine widely used Very similar to CLR
Most important differences: CLR supports many languages Java implemented on many platforms

19 Types Other OOs call them a class
Abstraction of data and behavior together Fields, methods, properties, events

20 Common Type System Provides wide range of modern operations
Shared by CLR, compilers, tools Framework for cross-language operation Integer 16 on some machines, 32 on others Limited code reuse between languages Each language has some types CTS establishes rules for cross-language calls

21 Managed Data, Garbage Collect
CLR reserves a contiguous block for initialized data – Managed Heap Fast allocation from it Older languages had to search for available space CLR performs deallocation as part of garbage collection When memory is low, frees up unreferenced memory

22 Getting started … From Program select Visual Studio .NET
Be sure to select NEW PROJECT Then Visual C# Project and From the right hand window choose CONSOLE APPLICATION In the bottom window change the NAME to your assignment number

23 OUR style Rules After USING statement, there are /// (comments)
Keep // but replace line 1 with YOUR NAME After // in line 2 replace text with the assignment # After // in line 3 replace text with DUE date Always insert a comment after } Ex: } // end namespace Now look at the example…

24 Helpful Hints No semicolons when: Next character is a {
The current character is a } The line of text is over 1 line long For the next few weeks, every program will have a Main() method.

25 Example Please watch carefully… First we will enter VS, C#
Then we will modify the skeleton program We will try to make it run First compile (check syntax etc) Build solution Correct errors Run program Debug, Start w/o debugging Check results Print results (next slide)

26 How to print program, results
From Visual studio, print program Run the program (Debug/Start) With the output (black) screen visible: press print screen on top of keyboard on top left of black screen right click icon press select all again press copy Start WORD, paste copied material there

27 Assignment 0 Due Date: NEXT CLASS
Write a program to display 3 lines of text. Line 1 your name Line 2 your grad year Line 3 your major Display instruction in C#: Console.WriteLine(“XXX”); (where XXX is the text to be displayed)

28 How to get started Turn off the monitor get paper and pen
What results are expected? What data are you given? Is that enough to produce output? In English, list variables if needed List steps needed to display results ex: display my name Write C# instructions Turn on Monitor, enter program

29 Assignment 0a Due Date: Next Class
Write a program to allow user input for name, reason for taking course, and your major.

30 Develop logic Turn off the monitor get paper and pen
What output is expected? What data are you given? Is that enough to produce output? In English, list variables if needed List steps needed to meet user request ex: allow user input for name display my name … Write C# instructions Turn on Monitor, enter program

31 More on Input/Output Console.Readline(); Console.Write (or WriteLine);
Example: string Name; // declare variable Name=Console.ReadLine(); Console.WriteLine(“My name is ” + Name); or Console.WriteLine(“My name is {0}”, Name);

32 More on Input/Output string name; string street; What would go here?
string city; Console.Write(“Please enter your Name ”); name = Console.ReadLine(); Console.Write(“Please enter your Street ”); street = Console.ReadLine(); What would go here? city = Console.ReadLine(); Console.WriteLine(“my bio {0} {1}, {2}”, name, street, city); Output: my bio smith 123 street, ffld

33 Program Style We listed some // comments earlier
We also should have 4 sections in every program // declare section (where you assign variables etc) // input section (accept user input) // computations (where you do calculations) // display results IN THAT ORDER

34 using System; namespace WTprog1 { // wt // program 1 // due date: 1/31/05 class Class1 static void Main(string[] args) // declare section // input section // computation section // display section { // end Main { //end class { // end namespace


Download ppt "IS 135 Business Programming"

Similar presentations


Ads by Google