OOP Class1

esse quam videri
Revision as of 18:13, 16 September 2013 by Cameron.Cintron (talk | contribs) (Introduction to Programming languages)
Jump to: navigation, search

Intro to Lab

  • Create student accounts
  • Create Student websites
  • Show Source Browser already installed in your oop folder

About Class


Introduction to Programming languages

Compliled vs Interpreted Languages
Interpreted Languages

Interpreted langauges read and parse the source input every time a they are executed. After each line is parsed it is converted to machine language and it is executed. Interperted languages are often referd to as scripting languages and are often good for small projects that need to be deployed quickly.

Interperated Scripting Languages are often used on the web

Common Interpreted Languages are Perl,PHP, Python and Ruby

Compiled Languages
Compiled languages use a complier to read and parse the input source code and convert it into machine language. The output binary file is then excuted. If the source changes the program needs to be recompiled. Complied prorams often execute faster and add extra layer of security becuase the source is not always readily available and executable. Complied code also tends to take up less memory and system resources.
Common Client Side

Common Server Side Languages

HelloWorld in several common programming languages Hello World Languages

Why .NET?

  • Discussion

.Net is a platform from Microsoft. It consists of several components. The base of the new platform is the [1] .NET framework. The .NET framework sits on top of the windows(or other operating systems like mono). The .net framework consists of the Common Language Runtime(CLR) and the Framework Class Library(FCL).

The CLR is a platform for compiling, debugging and executing .NET applications. Like java the CLR a virtual machine that can better control runtime security, memory management, and threading.

Here are some examples of the classes available in the .NET framework

*System	Contains fundamental classes and base classes that define commonly used value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions.
*System.Data	Consists mostly of the classes that constitute the ADO.NET architecture. The ADO.NET architecture enables you to build components that efficiently manage data from multiple data sources. In a disconnected scenario (such as the Internet), ADO.NET provides the tools to request, update, and reconcile data in multiple tier systems. The ADO.NET architecture is also implemented in client applications, such as Windows Forms, or HTML pages created by ASP.NET.
*System.Data.Common	Contains classes shared by the .NET Framework data providers. A .NET Framework data provider describes a collection of classes used to access a data source, such as a database, in the managed space.
*System.Data.SqlClient	Encapsulates the .NET Framework Data Provider for SQL Server. The .NET Framework Data Provider for SQL Server describes a collection of classes used to access a SQL Server database in the managed space.
*System.Drawing	Provides access to GDI+ basic graphics functionality. More advanced functionality is provided in the
*System.Drawing.Drawing2D	Provides advanced 2-dimensional and vector graphics functionality. This namespace includes the gradient brushes, the Matrix class (used to define geometric transforms), and the GraphicsPath class.
*System.Drawing.Imaging	Provides advanced GDI+ imaging functionality. Basic graphics functionality is provided by the System.Drawing namespace.
*System.Web	Supplies classes and interfaces that enable browser-server communication.
*System.Web.UI	Provides classes and interfaces that allow you to create controls and pages that will appear in your Web applications as user interface on a Web page.

System.Web.UI.HtmlControls Consists of a collection of classes that allow you to create HTML server controls on a Web Forms page. HTML server controls run on the server and map directly to standard HTML tags supported by most browsers. This allows you to programmatically control the HTML elements on a Web Forms page.

*System.Web.UI.WebControls	Contains classes that allow you to create Web server controls on a Web page. Web server controls run on the server and include form controls such as buttons and text boxes. They also include special purpose controls such as a calendar. Because Web server controls run on the server, you can programmatically control these elements. Web server controls are more abstract than HTML server controls. Their object model does not necessarily reflect HTML syntax.
*System.Windows.Forms	Contains classes that support design-time configuration and behavior for Windows Forms components.

Full List with descriptions http://msdn.microsoft.com/en-us/library/ms229335.aspx

Unlike Java the Microsoft CLR supports multiple languages.

Sun and Microsoft have different programing philosophies. Java write once (in java) run anywhere. CLR write in any CLR language and run on .NET The CLR from Microsoft supports several languages.

  • C# - java like language pronounced C Sharp (the language we will use for this course)
  • VB.NET - Visual Basic .NET
  • JScript
  • J# - Microsoft's Java-language
  • third party languages (cobol,eiffel,pascal,perl) Programming Language Partners

The CLR compiles the .NET languages into MS Intermediate Language (MSIL) which is similar to java's object code. It is an intermediary step between programming language and machine code. The MSIL allows .NET to support multiple programming languages. MSIL code is further compiled by the CLR at run time into machine code. This is known as JIT compilation or Just In Time.

.NET Applications

Hello world in C# for console really simple <csharp>using System; namespace HelloClass {

   class HelloWorld
       //All Console Apps start with Main Method
       public static void Main()
               Console.WriteLine("Hello World!");


Hello Console

<csharp>using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace HelloWorldConsole {

   class Program
       static void Main(string[] args)
           Console.WriteLine("Hello World!");      //Write Hello World! to the console standard out

} }</csharp>


MSIL <csharp>.method public hidebysig static void Main() cil managed {

 // Code size       11 (0xb)
 .maxstack  1
 IL_0000:  ldstr      "Hello World!"
 IL_0005:  call       void [mscorlib]System.Console::WriteLine(string)
 IL_000a:  ret

} // end of method HelloWorldConsole::Main </csharp> Fully Disassembled hello.cs

Hello WinForms

form1.cs <csharp> using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

namespace HelloWorldWindowsForms {

   public partial class Form1 : Form
       public Form1()
       private void Form1_Load(object sender, EventArgs e)
           this.Text = "Hello World App";  //Change the title of the form
                                           //yeah i know i could have done it in the designer
           label1.Text = "Hello World!";   //Say Hello in a Label

} </csharp>


Helloworld! WPF

Window1.xaml.cs <csharp> using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes;

namespace HelloWorldWpfApplication {

   /// <summary>
   /// Interaction logic for Window1.xaml
   /// </summary>
   public partial class Window1 : Window
       public Window1()
       private void Canvas_Loaded(object sender, RoutedEventArgs e)
           this.Title = "Hello WPF app";
           tbHello.Text = "Hello World!";      //Say hello to wpd TexBloc

} </csharp>

window1.xaml <xml> <Window x:Class="HelloWorldWpfApplication.Window1"

   Title="Window1" Height="300" Width="300">
       <Canvas Loaded="Canvas_Loaded">
           <TextBlock x:Name="tbHello" Canvas.Left="100" Canvas.Top="100"></TextBlock>



Other Links

ECMA C# and Common Language Infrastructure Standards
Mono - Ximian Linux .NET Copy
GotDotNet - Microsoft Site to bridge the gap between .NET team and .NET developers/students


  1. get .Net Framework 4.0 Microsoft .NET Framework 3.5 and .Net SDK .NET SKD or Mono Mono Downloads or VS2010 (handed out in class) and install it
  2. write and compile Helloworld in csharp as a c# console application bonus make hello world in something besides the console and make it interactive
  3. Read Learning c# Chapters 1-5 pg 0-46

[[OOP Class1]