.NET Overview Managed Code (MSIL) Managed Code (MSIL) CLR CLR JIT Compiler JIT Compiler Multi-Platform Multi-Platform Multi-Lingual (C#, VB.NET, Perl,

Slides:



Advertisements
Similar presentations
Introduction to.Net By Sam Nasr May 5,
Advertisements

You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
1 VBScript Session What we learn last session?
I/O Basics 12 January 2014Smitha N. Pai, CSE Dept.1.
Client Tools Explained EAE 3014
Advanced Piloting Cruise Plot.
Chapter 16 Graphical User Interfaces
Final and Abstract Classes
Basic Java Constructs and Data Types – Nuts and Bolts
1 Packages: Putting Classes Together. 2 Introduction The main feature of OOP is its ability to support the reuse of code: Extending the classes (via inheritance)
Copyright © 2003 Pearson Education, Inc. Slide 8-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Chapter 7 Constructors and Other Tools. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 7-2 Learning Objectives Constructors Definitions.
Chapter 1 C++ Basics. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 1-2 Learning Objectives Introduction to C++ Origins, Object-Oriented.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Using Perl for CGI Programming.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 12 Introduction to ASP.NET.
Program Verification Using the Spec# Programming System ETAPS Tutorial K. Rustan M. Leino, Microsoft Research, Redmond Rosemary Monahan, NUIM Maynooth.
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 11: Structure and Union Types Problem Solving & Program Design.
1 Introduction to ASP.Net 4.0 Development David Ringsell MCSD MCT MCPD.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
3 Copyright © 2005, Oracle. All rights reserved. Basic Java Syntax and Coding Conventions.
8 Copyright © 2005, Oracle. All rights reserved. Object Life Cycle and Inner Classes.
11 Copyright © 2005, Oracle. All rights reserved. Using Arrays and Collections.
1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
7 Copyright © 2005, Oracle. All rights reserved. Creating Classes and Objects.
8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
6 Copyright © 2005, Oracle. All rights reserved. Building Applications with Oracle JDeveloper 10g.
17 Copyright © 2005, Oracle. All rights reserved. Deploying Applications by Using Java Web Start.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
Addition Facts
Year 6 mental test 5 second questions
Lilian Blot Announcements Teaching Evaluation Form week 9 practical session Formative Assessment week 10 during usual practical sessions group 1 Friday.
1 Jini Tutorial, Part 3 Jini Programming. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2.
Data Structures ADT List
ITEC200 Week04 Lists and the Collection Interface.
Data Structures Using C++
ABC Technology Project
Access Lesson 13 Programming in Access Microsoft Office 2010 Advanced Cable / Morrison 1.
June 22, 2007 CMPE588 Term Project Presentation Discovery of Composable Web Services Presented by: Vassilya Abdulova.
1 / / / /. 2 (Object) (Object) –, 10 (Class) (Class) –, –, – (Variables) [ Data member Field Attribute](, ) – (Function) [ Member function Method Operation.
VOORBLAD.
Review Pseudo Code Basic elements of Pseudo code
1 public class Newton { public static double sqrt(double c) { double epsilon = 1E-15; if (c < 0) return Double.NaN; double t = c; while (Math.abs(t - c/t)
Introduction to .NET Framework
Microsoft.NET Object Oriented Software Engineering Based on a presentation by Murat Can Ganiz.
.NET Framework Overview
Tahir Nawaz Introduction to.NET Framework. .NET – What Is It? Software platform Language neutral In other words:.NET is not a language (Runtime and a.
Squares and Square Root WALK. Solve each problem REVIEW:
© 2012 National Heart Foundation of Australia. Slide 2.
1 User-Defined Classes The String class is a pre-defined class that is provided by the Java Designer. Sometimes programmers would like to create their.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
Copyright © 2003 by Prentice Hall Computers: Tools for an Information Age Chapter 15 Programming and Languages: Telling the Computer What to Do.
Week 1.
Lilian Blot CORE ELEMENTS SELECTION & FUNCTIONS Lecture 3 Autumn 2014 TPOP 1.
We will resume in: 25 Minutes.
CHAPTER 11 FILE INPUT & OUTPUT Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
Chapter 9: Using Classes and Objects. Understanding Class Concepts Types of classes – Classes that are only application programs with a Main() method.
1 XML Web Services Practical Implementations Bob Steemson Product Architect iSOFT plc.
A First Program Using C#
PerlNET: The Camel Talks.NET Jan Dubois The Perl Conference 6 San Diego, July 26 th 2002.
Introduction to C# AKEEL AHMED.
Presentation transcript:

.NET Overview Managed Code (MSIL) Managed Code (MSIL) CLR CLR JIT Compiler JIT Compiler Multi-Platform Multi-Platform Multi-Lingual (C#, VB.NET, Perl, J#, …) Multi-Lingual (C#, VB.NET, Perl, J#, …) Last Release: April 2003, Version 1.1 Last Release: April 2003, Version 1.1

ADO.NET (Data Access) ADO.NET (Data Access) ASP.NET (Web Applications) ASP.NET (Web Applications) Web Services Web Services Mobile.NET (Mobile Web Forms) Mobile.NET (Mobile Web Forms) Compact.NET Compact.NET Speech.NET Speech.NET.NET Technologies

PerlNET is not the Relativity theory, but…

PerlNET: Where To Get? PerlNET is part of ActiveState®s Perl Development Kit (PDK) starting from version 4.0. PerlNET is part of ActiveState®s Perl Development Kit (PDK) starting from version 4.0. Available as 30-days trial or commercial version. Available as 30-days trial or commercial version.

.NET Framework (available without a fee from the Microsoft web site).NET Framework (available without a fee from the Microsoft web site) ActivePerl starting from build 628 (available without a fee from the ActiveState web site). ActivePerl starting from build 628 (available without a fee from the ActiveState web site). PerlNET: Prerequisites

PerlNET Architecture

Create Perl packages that are fully functional both in Core Perl and.NET Create Perl packages that are fully functional both in Core Perl and.NET Create monolithic.NET applications Create monolithic.NET applications Working with.NET objects Working with.NET objects Create.NET classes (PerlNET components) Create.NET classes (PerlNET components) Extend existing.NET classes Extend existing.NET classes Features Overview

Implement.NET interfaces Implement.NET interfaces Create GUI applications using Windows Forms Create GUI applications using Windows Forms Use ADO.NET Framework to work against various Data Sources Use ADO.NET Framework to work against various Data Sources Authoring ASP.NET Web Application with help of close PerlNET relative - the PerlASPX product Authoring ASP.NET Web Application with help of close PerlNET relative - the PerlASPX product Features Overview (Contd)

PerlNET says Hello # Hello.pl use namespace "System"; use PerlNET qw(AUTOCALL); Console->WriteLine("Hello from PerlNET!");

# Hello.pl use namespace "System"; use PerlNET qw(AUTOCALL); Console->WriteLine("Hello from PerlNET!"); plc Hello.pl PerlNET says Hello

Holds helpful constants and functions specific for usage in the.NET Environment Holds helpful constants and functions specific for usage in the.NET Environment Importing functions and constants syntax: Importing functions and constants syntax: use PerlNET qw(f1, …, fn); PerlNET Module

Calling methods through arrow syntax ( -> ) Calling methods through arrow syntax ( -> ) Accessing properties through hash-reference syntax ( ->{} ) Accessing properties through hash-reference syntax ( ->{} ) Getting and Setting static fields with help of PerlNET::get() and PerlNET::set() helpers respectively Getting and Setting static fields with help of PerlNET::get() and PerlNET::set() helpers respectively Constructing new object through the new method Constructing new object through the new method Working with.NET classes

Working with.NET Classes Sample 1# fileinfo.pl 2use strict; 3use namespace "System"; 4use namespace "System.IO"; 5use PerlNET qw(AUTOCALL, true) 6 7# Construct FileInfo object 8my $file = FileInfo->new("c:\\fileinfo.pl"); 9 10# Get Length property 11print "File Length: ", $file->{Length}, "\n"; 12 13# Copy the file to "newfile.pl" invoking CopyTo method 14$file->CopyTo("newfile.pl", true); 15 16# Set LastAccessTime property of the file to current time 17$file->{LastAccessTime} = PerlNET::get("DateTime.Now"); 18 19# Output $file object 20print $file, "\n";

Provide Interface definition for.NET Framework Provide Interface definition for.NET Framework Implement Methods and Properties exactly as in case of Core Perl Module Implement Methods and Properties exactly as in case of Core Perl Module Pure Perl Components

=for interface POD blocks 1package YAPC::Samples::Car; 2 3=for interface 4# special attribute that tells PerlNET that 5# our class is compatible with Core Perl 6[interface: pure] 7 8# Constructor (should be static) 9static Car Car(int Year); 10 11# Method definition (returns string) 12str GetCarInfo(); 13 14# Property definition (an integer) 15int Year; 16=cut 17 18# Implementation goes here 19...

Package Implementation 1# Implementation goes here 2# Constructor 3 sub new 4 { 5 my ($self, $Model, $Year) 6 my $s = bless {}, $self; 7 $s->Year($Year); 8 return $s; 9 } # Get information about the car 12 sub OutputCarInfo 13 { 14 my $self = shift; 15 my $info = "Year of production: ". $self->Year(); 16 return $info; 17 }

Package Implementation (Contd) 1 # The code for setting and getting property 2 sub Year 3 { 4 my($self, $value) 5 # decide if Year is being read or mutated 6 if (defined $value) 7 { 8 # Property is being mutated 9 $self->{Year} = $value; 10 } 11 else 12 { 13 # Property is being read 14 return $self->{Year}; 15 } 16 }

Types in the Interface Definition.NET Type (System namespace) PerlNET type Booleanbool Charchar Sbytesbyte Int16short Int32int Int64long Bytebyte UInt16ushort UInt32uint UInt64ulong Singlefloat Doubledouble or num Decimaldecimal Objectany Stringstr

.NET Assembly: Whats inside? plc Car.pm –target="library"Car.dll

Download and Install an appropriate module Download and Install an appropriate module Create interface definition for component (=for interface) Create interface definition for component (=for interface) Perform workarounds if needed Perform workarounds if needed Steps for Wrapping Existing Perl Components

Wrapping Sample (Whitespace.pm) 1 # Whitespace.pm 2package Whitespace; 3use strict; 4=for interface 5[interface: pure] 6static Whitespace(str infile); 7static Whitespace(str infile, str outfile); 8int detect(); 9int cleanup(); 10wantarray! str[] Status(); 11str error(); 12int leadclean(); 13int trailclean(); 14int indentclean(); 15int spacetabclean(); 16int eolclean(); 17=cut

Wrapping Sample (Contd) 18 require Whitespace; # Convert Perl Hash to array 21 sub Status 22 { 23 my $self = shift; 24 = %{$self->status()}; 26}

C# Client Program // construct object Whitespace ws = new Whitespace("input.txt", "output.txt"); // Detect bogus whitespaces int det = ws.detect(); string err = ws.error(); // Check if there was an error if (err != null) { Console.WriteLine(err); return; } Console.Write("{0} bogus whitespaces found\n", det); if (det > 0) { // Output information // about detected whitespaces string[] stat = ws.Status(); foreach (string s in stat) { Console.WriteLine(s); } // Perform input file clean-up ws.cleanup(); }

May Extend existing.NET classes May Extend existing.NET classes May Implement.NET interfaces May Implement.NET interfaces Non-sealed Non-sealed.NET Components - Characteristics

No [interface: pure] attribute No [interface: pure] attribute Constructor Subroutine has the same name as module Constructor Subroutine has the same name as module First argument for non-static methods is reference and not hash: First argument for non-static methods is reference and not hash: my $this = shift; Unable to access internal object hash Unable to access internal object hash.NET Components – Implementation Issues

The same characteristics as.NET Components The same characteristics as.NET Components Mark interface definition with the following attribute: Mark interface definition with the following attribute: [interface: mixed] May store Perl structures as private data inside internal hash May store Perl structures as private data inside internal hash Retrieving internal hash as follows: Retrieving internal hash as follows: my ($this, Mixed Components

3 types of PerlNET Components 3 types of PerlNET Components –Pure Perl Type –.NET Type –Mixed Type Components Development Summary

Dynamic Web Server Pages (similar to JSP) Dynamic Web Server Pages (similar to JSP) Pages are compiled into.NET assemblies (better performance) Pages are compiled into.NET assemblies (better performance) Full separation of code and presentation layers Full separation of code and presentation layers Access all.NET Framework classes from ASP.NET pages code Access all.NET Framework classes from ASP.NET pages code Web Development and ASP.NET

PerlASPX Product Adds Perl to family of ASP.NET compliant languages Adds Perl to family of ASP.NET compliant languages Prerequisites: Prerequisites: –IIS Web Server –.NET Framework Important:.NET Framework should be installed after IIS

ASP.NET Page Sample 1 2 Page Language="Perl" Src="RandomCodebehind.aspx.pm" 3 Inherits=MyWebPage %> Random Number Generation <asp:button RUNAT="SERVER 12 id="btnGenerate" 13 TEXT="Generate New Number" 14 onClick=Generate 15 tooltip="Click to generate new random number"/>

Code-Behind # RandomCodebehind.aspx.pm package MyWebPage; use namespace "System"; use namespace "System.Web"; use namespace "System.Web.UI"; use namespace "System.Web.UI.WebControls"; =for interface [extends: System.Web.UI.Page] public void Generate(Object source, EventArgs e); protected field Label lblNum; =cut sub Generate { my $this = shift; $this->{lblNum}->{Text} = "Random number is ". int(rand(37)); }

Running ASP.NET Page

Programming Perl in the.NET Environment, book by Yevgeny Menaker, Michael Saltzman and Robert J. Oberg; ISBN: ; Publisher: Prentice Hall PTR Programming Perl in the.NET Environment, book by Yevgeny Menaker, Michael Saltzman and Robert J. Oberg; ISBN: ; Publisher: Prentice Hall PTR ActiveState PerlNET reference; Web Site: /PerlNET/Reference.html ActiveState PerlNET reference; Web Site: /PerlNET/Reference.html /PerlNET/Reference.html /PerlNET/Reference.html Make Your Existing Perl Apps.NET-compliant, article by Yevgeny Menaker, Publisher: DevX Inc.; Make Your Existing Perl Apps.NET-compliant, article by Yevgeny Menaker, Publisher: DevX Inc.; Web Site: PerlNET - An Introduction, article by Srinivasan Manickam and Michael Saltzman; Publisher: CoDe Magazine - September-October 2002 issue; PerlNET - An Introduction, article by Srinivasan Manickam and Michael Saltzman; Publisher: CoDe Magazine - September-October 2002 issue; Web site: Author Advanced.NET Applications in Perl article by Yevgeny Menaker and Srinivasan Manickam; Publisher: CoDe Magazine - November- December 2002 issue; Author Advanced.NET Applications in Perl article by Yevgeny Menaker and Srinivasan Manickam; Publisher: CoDe Magazine - November- December 2002 issue; Web site: speaks Perl now, article by Yevgeny Menaker, Publisher: DotNetForce.com; Web Site: der=article&File=article xml.NET speaks Perl now, article by Yevgeny Menaker, Publisher: DotNetForce.com; Web Site: der=article&File=article xml der=article&File=article xml der=article&File=article xml