Advanced Web Technologies INTRODUCTION CONTENTS I. Why dot Net? 1. 2. 3. 4. II. Introduction to Microsoft .Net Framework Building Blocks in .Net Drawback of Previous Languages Understand what is .Net Introduction to .Net 1. 2. 3. Anuradha Bhatia Types of Application Architecture .NET Initiative .Net Framework a) Components of .Net framework b) Advantages c) Requirements of .NET Advanced Web Technologies I. Introduction to .Net Framework & VB.NET 1. Introduction to Microsoft .Net Framework (Question: Explain the evolution of .NET = 4 marks) 1. In the year 2000, Microsoft launched its new development environment, calling it Microsoft Visual Studio .Net. Microsoft .Net, at its core, is very much similar to J2EE (Java 2 Enterprise Edition), 2. It allows a programmer to run both managed (code managed by the .Net Runtime) and un-managed code (not managed by the.Net runtime). 3. .Net uses Just – In – Time (JIT) compilers to translate your intermediate compiled code to native executable code, which significantly improves performance. 4. .Net also provides 'Platform independence' along with 'Language Independence'. 5. .Net also provides cross language support, meaning that modules and components written in different .Net compliant languages can call/use each other's modules and components. 6. Hence, it is possible to write your class in C#.NET, inherit it in VB.Net and finally use it in VC++.Net. At the time of this writing, as many as 22 languages are supporting the .Net Platform (including VB.NET, VB, C++, J#, Cobol, Eiffel, Pascal, FORTRAN, RPG, Smalltalk and others), enjoying full use of .net runtime and huge Framework class library (FCL). 7. .Net is useful for building variety of Windows applications, web application, web services, database applications and even embedded applications (using .Net compact version). 2. Building blocks of .Net framework (Question: Explain the building blocks of .Net framework = 4 marks) 1. Before VB .NET, there was VB and before there was VB, there was BASIC. BASIC stands for Beginner's All-purpose Symbolic Instruction Code. 2. It was developed in 1963 by computer scientists John Kemeny and Thomas Kurtz in Dartmouth College. 3. It was a general purpose programming language that was intended for beginners. 4. In 1991, BASIC was infused with its Visual component and became Visual Basic. 5. The new graphical user interface was pioneered by Alan Cooper. Anuradha Bhatia Advanced Web Technologies 6. Visual Basic was not an instant hit at first due to compatibility issues but it began getting a solid following in the mid to late nineties when developers started becoming familiar with it. In the new millennium, the Visual Basic 7. .NET became the successor of the Visual Basic programming languages. 8. Visual Basic .NET is Microsoft's Visual Basic on their .NET framework. 9. Microsoft's .NET framework is composed of preprogrammed code that users can access anytime. 10. This preprogrammed code is referred to as the class library. The programs in the class library can be combined or modified in order to suit the needs of programmers. 11. Programs in .NET run on the CLR or the Common Language Runtime environment. Regardless of computer, as long as this environment is present, programs developed in a .NET language will run. 1. 2. 3. 4. 5. 6. 7. 3. Drawback of Previous Languages There were days when computer programs were written using procedural languages like C, COBOL, Pascal, etc. Code was written around functions, i.e., logic is built to control which functions to perform. Then came the Object Oriented Programming (OOP) era where languages like C++ and Smalltalk became popular. Their code was written around data, i.e., logic was built by identifying the data in the system and performing functions around this data. he advent of the Object Oriented (OO) paradigm made it possible to build, manage, improve and debug bigger applications using components. The first commercially successful language to provide such runtime support was Java by Sun Microsystems (although such runtime support was present in languages like Smalltalk and even in VB). Java came with a runtime environment, called the Java Virtual Machine (JVM), which performs memory management, garbage collection, checking of runtime data types and memory access. Java also presented the idea of 'Platform independence' by providing their JVM implementation for different Operating Systems and H/w so a compiled java program can run on multiple Operating Systems and h/w. Anuradha Bhatia Advanced Web Technologies 4. Understand What .Net is. The .Net frame work consists of operating system, common language runtime, framework class library, ADO.Net and XML Library and .Net Applications. (Question: Explain the building of .Net framework = 4 marks) 1. Code execution and deployment is made much simpler for developers. 2. Code execution and deployment is assured to be safe and free from viruses. 3. Programming models are now similar across different languages. Choosing a programming language is already up to you. 4. Programming models adhere consistently with object oriented styles 5. The .Net Framework is the combination of layers of CLR, FCL, Data and XML Classes and our Window, Web applications and Web Services. 6. .NET framework allows programmers and developers to use code on the .NET framework to aid in the development of their software programs. Figure 1 II. Introduction to .Net 1. Types of Application Architecture .NET Framework and Languages 1. .NET Framework page, .NET Framework is designed for cross-language compatibility. 2. Cross-language compatibility means .NET components can interact with each other irrespective of the languages they are written in. Anuradha Bhatia Advanced Web Technologies 3. An application written in VB .NET can reference a DLL file written in C# or a C# application can refer to a resource written in VC++, etc. 4. This language interoperability extends to Object-Oriented inheritance. 5. This cross-language compatibility is possible due to common language runtime. 6. .NET Framework page, when the .NET program is compiled, the output of the compiler is not an executable file but a file that contains a special type of code called the Microsoft Intermediate Language (MSIL). 7. This MSIL is a low-level language which is designed to be read and understood by the common language runtime. 8. Because all .NET executable exist as IL, they can freely operate. 9. The Common Language Specification defines the minimum standards that .NET language compliers must confirm to. 10. Thus, any code compiled by a .NET complier can interoperate with the .NET Framework. 11. The Common Type System (CTS) defines the rules concerning data types and ensures that code is executed in a safe environment. 12. Since all .NET applications are converted to IL before execution all primitive data types are represented as .NET types. 13. This means that, a VB Integer and a C# int are both represented in IL code as System.Int32. 14. Because both the languages use a common and inter-convertible type system, it is possible to transfer data between components and avoid time-consuming conversions. Languages supported by .NET Framework 1. The table below lists all the languages supported by the.NET Framework and describes those languages. 2. The languages listed below are supported by the .NET Framework up to the year 2003. 3. In future there may be other languages that the .NET Framework might support. Language Description/Usage APL APL is one of the most powerful, consistent and concise computer programming languages ever devised. It is a language for describing procedures in the processing of information. It can be used to describe mathematical procedures having nothing to do with computers or to describe the way a computer works. C++ C++ is a true OOP. It is one of the early Object-Oriented Anuradha Bhatia Advanced Web Technologies programming languages. C++ derives from the C language. VC++: Visual C++ is the name of a C++ compiler with an integrated environment from Microsoft. This includes special tools that simplify the development of great applications, as well as specific libraries. Its use is known as visual programming. C# C# called as C Sharp is a full-fledged Object-Oriented programming language from Microsoft built into the .NET Framework. First created in the late 1990’s was part of Microsoft’s whole .NET strategy. Cobol COBOL (Common Business Oriented Language) was the first widely-used high-level programming language for business applications. It is considered as a programming language to have more lines of code than any other language. Component Pascal Component Pascal is a Pascal derived programming language that is specifically designed for programming software components. Curriculum No information. Eiffel Eiffel is an Object-Oriented (OO) programming language which emphasizes the production of robust software. Eiffel is strongly statically typed mature Object-Oriented language with automatic memory management. Forth Forth is a programming language and programming environment. It features both interactive execution of commands (making it suitable as a shell for systems that lack a more formal operating system), as well as the ability to compile sequences of commands into threaded code for later execution. Fortran Acronym for Formula Translator, Fortran is one of the oldest high-level programming languages that is still widely used in scientific computing because of its compact notation for equations, ease in handling large arrays, and huge selection of library routines for solving mathematical problems efficiently. Haskell Haskell is a computer programming language that is a polymorphic typed, lazy, purely functional language, quite different from most other programming languages. It is a wide-spectrum language, suitable for a variety of applications. It is particularly suitable for programs which need to be highly modifiable and maintainable. Anuradha Bhatia Advanced Web Technologies Java Language The Java language is one of the most powerful Object-Oriented programming languages developed till date. It's platform independence (not depending on a particular OS) feature makes it a very popular programming language. Microsoft JScript Microsoft JScript is the Microsoft implementation of the ECMA 262 language specification. JScript is an interpreted, object-based scripting language. It has fewer capabilities than full-fledged Object-Oriented languages like C++ but is more than sufficiently powerful for its intended purposes. Mercury Mercury is a new logic/functional programming language, which combines the clarity and expressiveness of declarative programming with advanced static analysis and error detection features. Its highly optimized execution algorithm delivers efficiency far in excess of existing logic programming systems, and close to conventional programming systems. Mercury addresses the problems of large-scale program development, allowing modularity, separate compilation, and numerous optimization/time trade-offs. Mondrian Mondrian is a simple functional scripting language for Internet applications. It is a functional language specifically designed to inter-operate with other languages in an OO environment. Current versions of Mondrian run on .NET. Mondrian also supports ASP.NET, allowing you to embed functional language code in web pages along with C# code. Oberon Oberon is a programming language very much like Modula-2 in syntax but with several interesting features. It's based on OOP concepts and provides a Windowsbased graphical user interface. Oz Oz is a high-level programming language that combines constraint inference with concurrency. Oz is dynamically typed and has first-class procedures, classes, objects, exceptions and sequential threads synchronizing over a constraint store. It supports finite domain and feature constraints and has powerful primitives for programming constraint inference engines at a high level. Pascal Principle objectives for Pascal were for the language to be efficient to implement and run, allow for the Anuradha Bhatia Advanced Web Technologies development of well-structured and well organized programs, and to serve as a vehicle for the teaching of the important concepts of computer programming. The Prime area of application that Pascal entails is the learning environment. This language was not really developed to be used for anything other than teaching students the basics of programming as it was originally developed for this purpose. Perl Practical Extraction and Report Language, Perl, is a language optimized for scanning arbitrary text files, extracting information from those text files, and printing reports based on that information. It's also a good language for many system management tasks. Python Python is an interpreted, interactive, Object-Oriented programming language. Python combines remarkable power with very clear syntax. It has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. RPG Report Program Generator, RPG, is used for generation of reports from data files, including matching record and sub-total reports. RPG is one of the few languages created for punch card machines that are still in common use today. RPG or RPG IV is a native programming language for IBM's iSeries minicomputer system. Scheme Scheme is a statically scoped programming language. It was designed to have an exceptionally clear and simple semantics and few different ways to form expressions. A wide variety of programming paradigms, including imperative, functional, and message passing styles, find convenient expression in Scheme. Small Talk SmallTalk is an expressive language that uses a simple sub set of human languages, nouns and verbs. Smalltalk was the first, and remains one of the few, pure object systems, which simply means that everything in a Smalltalk program is an object. Smalltalk is generally recognized as the second Object Programming Language (OPL). Standard ML Standard ML is a safe, modular, strict, functional, polymorphic programming language with compile-time type checking and type inference, garbage collection, exception handling, immutable data types and updatable references, abstract data types, and parametric modules. It has efficient implementations and a formal definition Anuradha Bhatia Advanced Web Technologies with a proof of soundness. Microsoft Visual Visual Basic is a "visual programming" environment for Basic developing Windows applications. Visual Basic makes it possible to develop complicated applications very quickly. This site is all about Visual Basic. 2. .NET Initiative Importance of .Net Framework (Question: Give the importance of Using Microsoft .Net = 4 marks) 1. Improved Reliability 2. Increased Performance 3. Developer Productivity 4. Powerful Security 5. Integration with existing Systems 6. Ease of Deployment 7. Mobility Support 8. XML Web service Support 9. Support for over 20 Programming Languages 10. Flexible Data Access 3. .Net Framework a) Components of .Net framework (Question: Explain the Microsoft .Net Frame work and its components = 8 marks) (Question: Explain the importance of CLR, MSIL, JIT, FCL, CLS, CTS = 8 Marks) Figure 2 Anuradha Bhatia Advanced Web Technologies In the .Net Architecture and the .Net Framework there are different important terms and concepts which we will discuss one by one: 1. 2. 3. 4. Common Language Runtime (CLR) .Net Common Language Runtime (CLR), also called .Net Runtime in short. It is a framework layer that resides above the OS and handles the execution of all the .Net applications. Our programs don't directly communicate with the OS but go through the CLR. Some Intermediate Language code is converted to native code, then the next time it's needed, the CLR reuses the same (already compiled) copy without re-compiling. MSIL (Microsoft Intermediate Language) Code: 1. .Net Program using any .Net compliant language (like C#, VB.Net, C++.Net) it does not get converted into the executable binary code but to an intermediate code, called MSIL or IL, understandable by CLR. 2. MSIL is OS and hardware independent code. When the program needs to be executed, this MSIL, or intermediate code, is converted to binary executable code (native code). 3. The presence of Intermediate Language makes possible the Cross Language Relationship as all the .Net compliant languages produce similar, standard Intermediate Language code. Just In Time Compilers (JITers) 1. Intermediate Language compiled code needs to be executed, CLR invokes the JIT compilers which compile the Intermediate Language code to native executable code (.exe or .dll) that is designed for the specific machine and OS. 2. JITers in many ways are different from traditional compilers as they compile the Intermediate Language to native code only when desired; e.g., when a function is called, the Intermediate Language of the function's body is converted to native code just in time. 3. The part of code that is not used by that particular run is never converted to native code. Framework Class Library (FCL) 1. The .Net Framework provides a huge Framework (or Base) Class Library (FCL) for common, usual tasks. 2. FCL contains thousands of classes to provide access to Windows API and common functions like String Manipulation, Common Data Structures, Anuradha Bhatia Advanced Web Technologies IO, Streams, Threads, Security, Network Programming, Windows Programming, Web Programming, Data Access, etc. 3. It is simply the largest standard library ever shipped with any development environment or programming language. 1. 2. 3. 4. 5. 1. 2. 3. 4. 5. 6. 7. 8. Common Language Specification (CLS) .Net Compliant Language' and stated that all the .Net compliant languages can make use of CLR and FCL. But what makes a language a '.Net compliant' language? The answer is the Common Language Specification (CLS). Microsoft has released a small set of specifications that each language should meet to qualify as a .Net Compliant Language. As IL is a very rich language, it is not necessary for a language to implement all the IL functionality; rather, it merely needs to meet a small subset of CLS to qualify as a .Net compliant language. This is the reason why so many languages (procedural and OO) are now running under the .Net umbrella. CLS basically addresses language design issues and lays down certain standards. Common Type System (CTS) .Net also defines a Common Type System (CTS). Like CLS, CTS is also a set of standards. CTS define the basic data types that IL understands. Each .Net compliant language should map its data types to these standard data types. This makes it possible for the 2 languages to communicate with each other by passing/receiving parameters to/from each other. For example, CTS defines a type, Int32, an integral data type of 32 bits (4 bytes) which is mapped by C# through int and VB.Net through its Integer data type. CLR also contains the Garbage Collector (GC), which runs in a lowpriority thread and checks for un-referenced, dynamically allocated memory space. If it finds some data that is no longer referenced by any variable/reference, it re-claims it and returns it to the OS so it can be used by other programs as needed. The presence of a standard Garbage Collector frees the programmer from keeping track of dangling data. Ask any C++ programmer how big a relief it is! Anuradha Bhatia Advanced Web Technologies Garbage Collector (GC) 1. CLR also contains the Garbage Collector (GC), which runs in a lowpriority thread and checks for un-referenced, dynamically allocated memory space. 2. If it finds some data that is no longer referenced by any variable/reference, it re-claims it and returns it to the OS so it can be used by other programs as needed. 3. The presence of a standard Garbage Collector frees the programmer from keeping track of dangling data. Ask any C++ programmer how big a relief it is! Figure 3 b) Advantages Advantages and Disadvantages of VB.Net (Question: Give the advantage and disadvantage of VB .Net = 4 marks) Advantages: 1. You can develop programs faster using the VB .NET programming language. You have so many resources in the .NET Class Library to take advantage of. VB .NET has full access to the .NET framework. Anuradha Bhatia Advanced Web Technologies 2. It is easier to program using Microsoft development environments like Visual Studio. 3. It is easier to organize your thoughts in an object-oriented programming language like VB .NET. 4. There are a lot of books and tutorials to improve your skills in VB .NET. 5. The VB language itself interfaces with Microsoft applications seamlessly (VBA). Disadvantages: 1. Debugging is very difficult on the VB .NET programming languages especially with long codes. 2. You'll spend hundreds of dollars purchasing development tools from Microsoft (Retail version of Visual Studio costs around $300). 3. VB .NET is most useful for RAD. 4. The VB .NET programming language is most useful for rapid application development or RAD. 5. If you want to get your programs up and running in a jiffy then you should use VB .NET. 6. Since VB .NET is more suitable for quick and easy programming, it is not recommended for the large, enterprise-wide software development solutions. 7. Debugging and finding your way through long and tangling lines of VB .NET code will simply give you headaches. c) Requirements of .NET Minimum System Requirements to Install .NET The minimum requirements are: RAM: 256 MB (Recommended) Processor: Pentium II 450 MHz Operating System: Windows 2000 or Windows XP Hard Disk Space: 3.5 GB (Includes 500 MB free space on disk) Anuradha Bhatia