1. FEDT VB.NET
F R O N T E N D D E S I G N T O O L
U S I N G
V B . N E T
P R E S E N T A T I O N B Y :
A N K I T V E R M A
( I T D E P A R T M E N T )
A N K I T V E R M A A S S T . P R O F E S S O R
U N I T - 1
2. 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
3. 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 3ANKIT VERMA
5. What Is FEDT?
Front End Design Tool
Front End
HTML
CSS
Java Script
.NET
C# .NET
ASP .NET
J# .NET
VB .NET
28-11-2014 5
Back End
Database
Oracle
SQL
MS Access
ANKIT VERMA
7. 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 7ANKIT VERMA
8. What Is .NET?
Is .NET a Programming Language? NO
Is .NET an Operating System? NO
“.NET is a framework”
28-11-2014 8ANKIT VERMA
9. 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 9ANKIT VERMA
10. 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 10ANKIT VERMA
11. 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 11ANKIT VERMA
12. 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 12ANKIT VERMA
13. 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 13ANKIT VERMA
14. Versions Of .NET Framework
.NET Framework 4.0
Visual Studio 2010
28-11-2014 14ANKIT VERMA
15. 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 15ANKIT VERMA
21. Components Of .NET Architecture
Three Components:
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 21
CLR CTS FCL
ANKIT VERMA
23. 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 23ANKIT VERMA
24. 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 24ANKIT VERMA
25. CLR Architecture
Exception Manager
Security Checker
Type Checker
Class Loader
Debug Engine
Thread Support
Code Manager
Garbage Collector
28-11-2014 25
Components Of CLR
ANKIT VERMA
26. 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 26ANKIT VERMA
27. 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 27ANKIT VERMA
28. 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 28ANKIT VERMA
30. 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 30ANKIT VERMA
31. 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 31ANKIT VERMA
32. 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 32ANKIT VERMA
34. 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 34ANKIT VERMA
35. 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 35ANKIT VERMA
36. 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 36ANKIT VERMA
38. Execution Process
Source Code
(VB .NET,
C#.NET)
Language
Compilers
IL
(EXE /
DLL)
28-11-2014 38
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
ANKIT VERMA
39. Execution Process
28-11-2014 39ANKIT VERMA
Executing The Application
Class
Libraries
Class
Loader
JIT
Compiler
Managed
Code
Output
CLR
(Execution)
(Run Time
Manager)
IL or MSIL
Code
41. 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 41ANKIT VERMA
42. Memory Management
28-11-2014 42ANKIT VERMA
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.
43. 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 43ANKIT VERMA
44. Garbage Collection Process
28-11-2014 44ANKIT VERMA
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.
45. Garbage Collection Process
28-11-2014 45ANKIT VERMA
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.
46. Garbage Collection Process
28-11-2014 46ANKIT VERMA
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.
47. Garbage Collection Process
28-11-2014 47ANKIT VERMA
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.
49. Assemblies
28-11-2014 49ANKIT VERMA
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.
50. 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 50ANKIT VERMA
51. 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 51ANKIT VERMA
53. 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 53ANKIT VERMA
55. 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 55ANKIT VERMA
56. Types Of Assemblies
Static Assemblies
Dynamic Assemblies
Private Assemblies
Public Assemblies or Shared Assemblies
28-11-2014 56ANKIT VERMA
58. 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 58ANKIT VERMA
59. 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 59ANKIT VERMA
60. 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 60ANKIT VERMA
61. 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 61ANKIT VERMA
62. Program Syntax
Syntax:
Try
<statement>
Catch Ex as Exception
<statement>
End Try
28-11-2014 62ANKIT VERMA
66. 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 66ANKIT VERMA
67. 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 67ANKIT VERMA
68. 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 68ANKIT VERMA
69. 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 69ANKIT VERMA
70. 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 70ANKIT VERMA
71. CAS Benefits
Restricts what your code can do.
Restrict which code can call your code.
Identify code.
28-11-2014 71ANKIT VERMA
72. THANKYOU
P R E S E N T A T I O N B Y :
A N K I T V E R M A
( I T D E P A R T M E N T )
DOUBTS
A N K I T V E R M A A S S T . P R O F E S S O R