Chapter 1-NET Framework
Chapter 1-NET Framework
NET framework
Chapter One: Introduction to .NET framework Before emergency of .NET framework, programmers used a
1.1 Chapter objectives number of tools to write programmers as depicted before
By the end of this, learners should be able to: ▪ Windows GUI development: Win32 API, MFC, Visual
v). Understand how compilation is done by .NET framework It’s the traditional software development for the Windows. It has
1.2 Life before .NET programming memory management and pointer arithmetic.
1
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
approach
However, C++ remains a difficult and error-prone experience.
classes that facilitate the construction of Win32 applications. applications unless you are willing to drop down to low-level
2
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
1.2.4 Life As a Java/J2EE Programmer Component Object Model (COM) is Microsoft’s previous
providing programmers with a large number of predefined C++ programmers can build COM classes that can be
“packages” that contain various type definitions. used by VB6. Delphi programmers can use COM classes
built using C.
However, java has a number of limitations such as limited It has a number of challenges such as language independence
ability to access non-Java APIs, little support for true cross- is limited, doesn’t support for classical inheritance) and its
language integration and it’s not appropriate for many extremely complex under the hood.
3
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
features into its family of operating systems and products. 1.3 .Net framework
The result of the above is completely unrelated syntaxes e.g. Applications, mobile applications, Desktop based applications
JavaScript has a syntax much like C, while VBScript is a subset within Microsoft environment. It’s consistent object-oriented
of VB6 which results to a highly confused mishmash of providing a portable as well as managed environment
system e.g. An “int” in JavaScript is not quite the same as an It provides tools and technologies necessary compile time and
“Integer” in VB6. The rescuer is Microsoft .NET framework runtime foundation to build and run any language that conforms
4
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
Oriented Application .
XML and SOAP and is towards more open standards rather than
Fig:1.0-.NET is cross platform
Microsoft its proprietary tendencies. It offers a fundamental shift
.NET is motivated by a number of factors such as in Microsoft strategy by moving application development from
i. popularity of electronic devices meaning it’s capable of client-centric to server-centric.
providing interaction between wide varieties of devices
such as cell phones, Personal Digital Assistants, .NET framework offers programmers with a number of services
5
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
Runtime).
The main two components of .Net Framework are Common Fig 1.1:-NET architecture
1.4.1. Common Language Runtime (CLR)
Language Runtime (CLR) and .Net Framework Class Library
(FCL) which provides a core services such as ASP.NET, It’s the engine behind the .NET framework that handles
windows, ADO.NET, windows forms, XML support e.tc
execution of all managed application code. It works as a
6
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
Language Specification (CLS). 11) Interoperation between managed code, COM objects
Some of the services provided CLR include: and pre-existing DLLs (unmanaged code and data)
2) Application memory isolation 13) Support for developer services (profiling, debugging,
etc.)
3) Garbage collection
1.4.2. . Net Framework Class Library (FCL)
4) Verification of type safety
FCL is a huge collection of language-independent and type
5) Thread execution
safe reusable classes, interfaces and values that expedite and
6) Conversion of IL to native code
optimize the development process and provide access to
7) Access to metadata (enhanced type information) system functionality. The libraries are arranged into a logical
8) Managing memory for managed objects
grouping according to their functionality and usability is called
10) Exception handling including cross language FCL provides the consistent base types that are used across
7
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
Namespace is the root for types in the .NET Framework. It’s a framework used to design rich clients for windows
8
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
1.5 Compilation in .NET C# compiler e.t.c) converts the source code to an intermediate
Applications developed in the .NET platform don’t directly language code which is known as IL code or Microsoft
interact with the OS but rather, they talk to the CLR and the Intermediate Language (MSIL) or Common Intermediate
CLR manages/handles the execution of the applications. Language (CIL) which is a CPU independent set of
system. The JIT converts the MSIL code into native code to
Fig 1.4: .NET applications which is Operating System specific, the overall effect being the
9
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
architecture in which the code is executing, so some 7. JIT allows the IL code to be hardware independent.
performance gains are possible. 8. CLR also allows for enforcement of code access
security.
During compilation, metadata is always generated and stored 9. Verification of type safety.
with the compiled code in a file known as manifest which 10. Access to Metadata (enhanced Type Information)
contains information about the members, types, references and 1.7 NET compliant Languages
all the other data that the Common Language Runtime Some of the languages supported by Microsoft include VB.NET,
C++, C#, J#, Jscript, Visual C++. However, there are some third-
1.6 Advantages associated with CLR execution
parties’ languages such as APL, COBOL, Pascal, Eiffel,
Some of the advantages associated with CLR execution Haskell, ML, Oberon, Perl, mercury Python, Scheme,Oz,APL,
includes
CAML,Scheme, Smalltalk e.t.c
1. Support for developer services (debugging)
1.8 Common Language Infrastructure (CLI)
2. Interoperation between managed code and unmanaged
code (COM, DLLs). CLI allows for cross-language development.
10
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
11
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
Not all languages support all CTS types and features e.g.
does not
12
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020
DIT 006-Introduction to Visual Basic .NET framework
1.9 Comparison & contrast of .NET & J2EE Architecture machine. Can also support other platforms provided it
has its own JIT complier.
We compare the two frameworks from the following
perspectives
▪ Language support
▪ Execution Engine
❖ J2EE-Tied to Java but supports other languages via
❑ J2EE-Java source code compiles into machine- interface technology
independent byte code. The Runtime Environment
is Java Virtual Machine (JVM) ❖ .NET-its Language independent supporting any
language if mapping exists from that language to IL
❑ .NET-Any compliant language compiles into
MSIL/IL/CIL. The Runtime environment is ▪ Tools support
Common Language Runtime( CLR)
❖ J2EE-there are many IDE for programming in Java e.g.
Both JVM and CLR support services, such as code
NetBeans, eclipse, blueJ,Jcreator,JDeveloper, android
verification, garbage collection, and code security.
studio
13
Edward Kioko|Email:[email protected]|Mobile number: +725-695-782| © 2020