FEDT VB.
NET
FRONT END DESIGN TOOL
USING
VB .NET
UNIT - 1
PRESENTATION BY:
ANKIT VERMA
(IT DEPARTMENT)
ANKIT VERMA ASS T. PROFESSOR
Which Book To Follow ?
Book Bank
Visual Basic 2010, Step By Step, Michael Halvorson
Complete Syllabus
C. Komalavalli, Sanjib K Sahu (Ane Books)
28-11-2014 ANKIT VERMA 2
Languages
Procedural Language (C)
Write Procedures
Object Oriented Language (C++)
Abstraction
Polymorphism
Encapsulation
Inheritance
Object Based Language (VB)
Any three features of OOPS
Pure Object Oriented Language (Java, .NET)
OOPS + Classes
28-11-2014 ANKIT VERMA 3
System Hierarchy
Levels In System Hierarchy
28-11-2014 ANKIT VERMA 4
What Is FEDT?
Front End Design Tool
Front End Back End
HTML Database
CSS Oracle
Java Script SQL
.NET MS Access
C# .NET
ASP .NET
J# .NET
VB .NET
28-11-2014 ANKIT VERMA 5
.NET Introduction
28-11-2014 ANKIT VERMA 6
Introduction To .NET
It is Platform Neutral Framework.
It is layer between OS and Programming Language.
It support many programming languages like
VB.NET, C#.NET, ASP.NET etc.
.NET provides a common set of class libraries, which
can be accessed from any .NET base programming
language.
28-11-2014 ANKIT VERMA 7
What Is .NET?
Is .NET a Programming Language? NO
Is .NET an Operating System? NO
“.NET is a framework”
28-11-2014 ANKIT VERMA 8
Why .NET?
Why Not Use VB?
VB is very easy
Not flexible to develop serious applications
Programmers hate it because it is very easy
Why Not Java?
It does not have multi language support
Slight tough as compared to .NET
28-11-2014 ANKIT VERMA 9
Benefits Of .NET Framework
Consistent Programming Model
Consistent OOP model across various languages
Connecting to database
Retrieving data from database
Reading text from file
Writing text in a file
Cross-platform Support
Support CLR to run .NET application
Interoperability between multiple Window OS
28-11-2014 ANKIT VERMA 10
Benefits Of .NET Framework
Language Interoperability
Piece of code written in one language can be used in other
language.
Facilitate reuse of code.
Improves efficiency.
Automatic Management Of Resources
Use resources like file, memory, database connection etc.
Automatically free resources when not in use.
Ease Of Deployment
Installation of new components not affect existing
applications.
28-11-2014 ANKIT VERMA 11
Versions Of .NET Framework
.NET Framework 1.0
Released by Microsoft in February 13, 2002.
Visual Studio .NET 2002
.NET Framework 1.1
Released in April 03, 2003.
Visual Studio .NET 2003
Built in support for ASP .NET, ODBC & Oracle Database
.NET Framework 2.0
Released in January 22, 2006.
Visual Studio .NET 2005 & Microsoft SQL Server 2005
New themes, skins, web controls, data controls in ASP .NET
28-11-2014 ANKIT VERMA 12
Versions Of .NET Framework
.NET Framework 3.0
Released in November 21, 2006.
Four new technologies
Windows Presentation Foundation (WPF)
Windows Communication Foundation (WCF)
Windows Workflow Foundation(WF)
Windows CardSpace (WCS)
.NET Framework 3.5
Released in November 19, 2007.
Features like Language Integrated Query (LINQ), ASP .NET
AJAX, extension methods
Visual Studio 2008
28-11-2014 ANKIT VERMA 13
Versions Of .NET Framework
.NET Framework 4.0
Visual Studio 2010
28-11-2014 ANKIT VERMA 14
Supported Applications
Console Application
Command line application
Windows Forms
GUI interface to user
Web Forms
Web pages
Web Services
Software components that perform task in distributed manner
Reporting Application
Windows user interface & report
28-11-2014 ANKIT VERMA 15
Client - Server
28-11-2014 ANKIT VERMA 16
Two Tier & Three Tier Client-Server Model
Two Tier Architecture
Database (Data Tier)
Client Application (Client Tier)
28-11-2014 ANKIT VERMA 17
Two Tier & Three Tier Client-Server Model
Three Tier Architecture
Database Layer
Business Layer
Client Layer
28-11-2014 ANKIT VERMA 18
.NET Architecture
28-11-2014 ANKIT VERMA 19
.NET Architecture
28-11-2014 ANKIT VERMA 20
Components Of .NET Architecture
Three Components: CLR CTS FCL
Common Language Runtime (CLR)
Similar to JVM of Java
Virtual machine component of framework
.NET program is monitored by CLR
Common Type System (CTS)
Manage datatypes supported by various .NET programming
languages
Provide language interoperability
Framework Class Libraries (FCL)
Similar to class libraries of Java
Consists of various base classes used to support different services of
framework
28-11-2014 ANKIT VERMA 21
1. CLR
28-11-2014 ANKIT VERMA 22
Common Language Runtime (CLR)
It is an agent used to execution & verification of code
Manage services like
Thread Management
Memory Management
Type Safety
Exception Handling
Load MSIL (Microsoft Intermediate Language) code
MSIL code is similar to byte code of java
MSIL code consists of instructions for loading, storing,
initializing & calling methods on objects
MSIL code also known as common Intermediate Language
28-11-2014 ANKIT VERMA 23
Common Language Runtime (CLR)
JIT (Just In Time) compiler of CLR compiles code
into native Machine code for executing application
CLR can execute code written in any language.
CLR provide code access security & garbage collection
CLR allows code created in one language can be
communicated in other language
CRL support common type system, meta data &
common execution environment.
Managed Code: targets the runtime
Unmanaged Code: not target the runtime
28-11-2014 ANKIT VERMA 24
CLR Architecture
Components Of CLR
Exception Manager Thread Support
Security Checker Debug Engine
Code Manager Type Checker
Class Loader Garbage Collector
28-11-2014 ANKIT VERMA 25
CLR Components
Compiler & Class Loader
Compiler compile source code into intermediate code.
This code consists of MSIL & Meta Data
These are contained in Portable Executable (PE) file
Class Loader loads this data in runtime
Code Manager
Manage the code during execution
Allocate memory to objects
Exception Manager
Handle exception in both managed & unmanaged code
28-11-2014 ANKIT VERMA 26
CLR Components
Security Checker
Restricts access to system resources like
Hard Disk
MSIL Code
Thread Support
Support multithreading
Debug Engine
Find & remove the bugs from programs
Type Checker
Datatype checking of variable
28-11-2014 ANKIT VERMA 27
CLR Components
Garbage Collector
Automatic garbage collection of object when object is no longer
in use
Periodically check heap memory where objects get memory
28-11-2014 ANKIT VERMA 28
2. CTS
28-11-2014 ANKIT VERMA 29
Common Type System (CTS)
Type refers to datatypes supported by programming
languages
Provide common type system for all languages
CTS support object oriented concepts
So all types are objects
Share common data type
Language Integration
Code of one language can be inherited by code in other language
Better Performance
Type Safety
28-11-2014 ANKIT VERMA 30
Common Type System (CTS)
Two main types supported by framework
Value Type
Primitive or Built In Datatype
Passed In Methods By Value Method
Memory Allocated From Stack
Reference Type
Store Memory Address Of Variable Using Pointer
Passed In Methods By Reference Method
Stored In Heap
28-11-2014 ANKIT VERMA 31
Common Type System (CTS)
Common Language Specification (CLS)
CLS is subset of CTS
As per standard, code written in a CLS must be compliant with
code written in another language.
Describe guidelines for defining .NET language
It compile code into Intermediate Language, so this code
executed by CLR.
28-11-2014 ANKIT VERMA 32
3. FCL
28-11-2014 ANKIT VERMA 33
Framework Class Libraries (FCL)
Collection Of Reusable, Manageable Classes &
Interfaces
Provide Support For System Services
Act As Interface Between Application & Operating
System
Hierarchical Structure
Namespace
Organization of class libraries according to their functionality
called namespace
All classes of library are object oriented & can be
included in code of any .NET supported language
28-11-2014 ANKIT VERMA 34
Class Libraries
Integration Of 3rd Party Components
Perform Different Tasks
Database Connectivity
String Handling
I/O Functionality
File Handling
Library Split Into Two Parts:
Basic Class Library (BCL)
Framework Class Library (FCL)
FCL is superset of BCL
28-11-2014 ANKIT VERMA 35
Class Libraries
Windows Form:
Consists of classes related to design, components, passing messages to user etc.
Web Form (ASP .NET):
Consists of classes related to caching, security, authentication, configuration..
XML:
Consists of classes related to XSLT, XPath, XQuery, Serialization.
Database (ADO .NET):
Consists of classes related to connection, command, retrieving data into reader &
adapter, SQL types, executing procedures
28-11-2014 ANKIT VERMA 36
Execution Process
28-11-2014 ANKIT VERMA 37
Execution Process
Compiling .NET Application
Compiler compiles code into intermediate language as per CLR
specification.
Metadata is also gathered during compilation.
All data contained in Assembly File, which can be .EXE or
.DLL
Source Code IL
Language
(VB .NET, Compilers (EXE /
C#.NET) DLL)
28-11-2014 ANKIT VERMA 38
Execution Process
Executing The Application
Class
Libraries
IL or MSIL Class JIT Managed
Code Loader Compiler Code
CLR
(Execution)
Output
(Run Time
Manager)
28-11-2014 ANKIT VERMA 39
Memory Management
28-11-2014 ANKIT VERMA 40
Memory Management
Resource Allocation
Automatic memory management is one of the services that
CLR provides during execution.
The Garbage Collector manages the allocation release of memory
for an application.
The Microsoft .NET CLR requires that all resources be
allocated from the managed heap.
Objects are automatically freed when they are no longer needed
by the application.
28-11-2014 ANKIT VERMA 41
Memory Management
Newly created objects are part of a Generation 0,
The objects that survive a garbage collection are tagged as
Generation 1 and
The Generation 1 objects that survive another collection are
Generation 2 objects.
28-11-2014 ANKIT VERMA 42
Garbage Collection Process
Every application has a set of roots. Roots identify storage
locations, which refer to objects on the managed heap or to
objects that are set to null.
The list of active roots is maintained by JIT compiler
and CLR and is made accessible to the garbage
collector’s algorithm.
When the garbage collector starts running, it makes the
assumption that all objects in the heap are garbage.
28-11-2014 ANKIT VERMA 43
Garbage Collection Process
Figure shows a heap with several
allocated objects where the
application’s roots refer directly
to the object A, C, D and F.
All of these objects become part
of the graph. When adding object
D, the collector notices that this
object refers to object H and
object H is also added to the
graph.
The collector continues to walk
through all reachable objects
recursively.
28-11-2014 ANKIT VERMA 44
Garbage Collection Process
Once this part of the graph is complete, the garbage collector
checks the next root and walks the object again.
As the garbage collector walks from the object to object, iFit
attempts to add an object to the graph that it previously
added, then the garbage collector can stop walking down the
path.
Once all the roots have been checked, the garbage collector’s
graph contains the set of all objects that are somehow
reachable from the application’s roots.
28-11-2014 ANKIT VERMA 45
Garbage Collection Process
The garbage collector now walks
through the heap linearly, looking
for contiguous block of garbage
objects.
The garbage collector shifts the non
garbage object down in memory,
removing all the gaps in the heap.
So, the garbage collection must
modify the application’s root, so that
the pointers point to the object’s
new location.
In addition, if any object contains a
pointer to another object, the
garbage collector is responsible for
correcting these pointers as well.
28-11-2014 ANKIT VERMA 46
Garbage Collection Process
After all the collection has been identified, all the non
garbage has been compacted and all the non garbage pointers
have been fixed up, the next object is positioned just after the
last non garbage object.
At this point, the new operator is tried again and the resource
requested by an application is successfully created.
28-11-2014 ANKIT VERMA 47
Assemblies
28-11-2014 ANKIT VERMA 48
Assemblies
Assembly is a standard for components developed with .NET
They are building blocks of .NET framework application.
It is smallest unit of deployment.
It consists of one or more files (dll, exe, html etc.)
It is self describing unit & all programs constructed in .NET
are constructed in assemblies only.
It consists of MSIL, metadata & resources (such as bitmap
that the application require for execution)
Namespace are also stored in assemblies only. They are
playing important role in deployment & versioning.
Assemblies can be .DLL or .EXE but they differ in their
content.
28-11-2014 ANKIT VERMA 49
Assemblies
Assembly Manifest
Assembly consists of assembly
metadata called Assembly Manifest.
Assembly has one entry point
CRL does not actually work
with managed modules, it
works with assemblies.
Assembly is logical grouping of
one or more managed module.
Assembly is the smallest unit
of reuse, security & versioning.
28-11-2014 ANKIT VERMA 50
Assemblies
When you are using JIT compiler to compile your
code from managed code to active code, the JIT
compiler will look for IL code, that is stored in
portable executable file along with associated
manifest.
Every time you build a web form or windows form in
.NET, you are building an assembly.
Every one of these above applications will contain at
least one assembly.
28-11-2014 ANKIT VERMA 51
Structure Of Assembly
28-11-2014 ANKIT VERMA 52
Assembly Manifest
The assembly manifest is where
the details of assembly are
stored.
The assembly is stored within
the DLL or EXE itself.
Assemblies can either be single
or multi files assemblies and
therefore assemblies manifest
can either be stored as
assembly or as a separate file.
28-11-2014 ANKIT VERMA 53
Diagram
28-11-2014 ANKIT VERMA 54
Type Metadata
This metadata contains information on the types that
are exposed by the assembly such as security
permission information, class and interface
information and other assembly information.
When an application is started in .NET, the
application will look for an assembly in the
installation folder.
Assemblies that are stored in a local installation folder are
referred to as Private Assemblies.
If application cannot find assembly in installation folder the
assembly will talk to Global Assembly Cache (GAC) for
an assembly.
28-11-2014 ANKIT VERMA 55
Types Of Assemblies
Static Assemblies
Dynamic Assemblies
Private Assemblies
Public Assemblies or Shared Assemblies
28-11-2014 ANKIT VERMA 56
Exception Handling
28-11-2014 ANKIT VERMA 57
Exception Handling
“An exception is error condition or any abnormal
condition or unexpected behavior in program and
disturbs the normal flow of instruction”
.NET uses Structured Exception Handling.
Exception Example:
Arithmetic Exception
OverFlow Exception
NullReference Exception
28-11-2014 ANKIT VERMA 58
Exception Handling Steps
When exception is raised, exception object is thrown
to runtime system.
Object contain
Cause of exception
Type of exception
State of program when exception occurred
It will handled by runtime & thus leads to abrupt
termination of program.
28-11-2014 ANKIT VERMA 59
Need Of Exception Handling
Handle Runtime Error like
Unavailability of data
Trying to access non-existent data
Trying to update read-only data
Conversion between data type might fail
28-11-2014 ANKIT VERMA 60
Exception Handling Blocks
Try…………….. Catch…………….. Finally
Try
Try Block contain anticipating code which may raise exception.
Try keyword tell compiler that we want to handle area of
events.
Catch
Catch Block is handler to catch the exception.
Catch block tells application what to do if an error occurs.
Finally
Finally Block is optional.
Finally keyword will occur regardless if the Try-Catch worked
successfully or not.
28-11-2014 ANKIT VERMA 61
Program Syntax
Syntax:
Try
<statement>
Catch Ex as Exception
<statement>
End Try
28-11-2014 ANKIT VERMA 62
Program
Program Output
28-11-2014 ANKIT VERMA 63
Program
Program Output
28-11-2014 ANKIT VERMA 64
Code Access Security
28-11-2014 ANKIT VERMA 65
Code Access Security (CAS)
.NET framework has a built in security system called
as CAS.
CAS enables administrator to control actions
performed by code.
It is security mechanism through which we can place
the security constraints & controls on source code at
runtime.
In .NET, security is achieved by CAS Model.
In CAS Model, CLR checks permission of the code to
access a restricted resource, before granting access.
28-11-2014 ANKIT VERMA 66
Security Policy
Identifying the code that is granted permission to
run.
Identifying the tasks that a code is allowed to
perform.
Identifying the tasks that the users are permitted to
perform.
Identifying the resources that the code can access.
28-11-2014 ANKIT VERMA 67
CAS Supported Security Model
CAS supports the security model by
Evidence
Evidence is type of information used to determine the type of rights
that code is granted.
This information is useful for CLR.
Security Policies
When Assembly is loaded, CLR check security policy by running
Evidences.
Security Policy can be defined in four levels:
Enterprise
User
Machine
Application
28-11-2014 ANKIT VERMA 68
CAS Supported Security Model
Permission
Permissions are rights for accessing the particular operations
permitted by Security Policy.
Present in class System.Security.Permissions namespace.
Permission Sets
Named collections of Permissions are known as Permission Sets.
28-11-2014 ANKIT VERMA 69
CAS Functions
Define Permission & Permission Sets that represents
the right to access various system resources.
Enable code to request the permission set requires in
order to run, permission that would be useful to have
& specifies which permission the code must have.
Grant permission to each assembly that is loaded,
based on permission requested by code & on the
operations permitted by security policy.
Enable code to demand that its callers have specific
permissions or process digital signature, thus allow
specific callers to call the particular code.
28-11-2014 ANKIT VERMA 70
CAS Benefits
Restricts what your code can do.
Restrict which code can call your code.
Identify code.
28-11-2014 ANKIT VERMA 71
THANKYOU
DOUBTS
PRESENTATION BY:
ANKIT VERMA
(IT DEPARTMENT)
ANKIT VERMA ASS T. PROFESSOR