Friday, April 3, 2020

VB.Net Lecture1


MARWARI COLLEGE, RANCHI
(AN AUTONOMOUS UNIT OF RANCHI UNIVERSITY FROM 2009)

- Prakash Kumar, Dept. of CA
-Raju Manjhi, Dept. of CA 
__________________________________________________________________________________ 

Programming in Visual Basic.NET
BCA/IT- Sem-IV(Old Course)

Visual Basic .NET (VB.NET) is an object-oriented computer programming language implemented on the .NET Framework. Although it is an evolution of classic Visual Basic language, it is not backwards-compatible with VB6, and any code written in the old version does not compile under VB.NET.

Like all other .NET languages, VB.NET has complete support for object-oriented concepts. Everything in VB.NET is an object, including all of the primitive types (Short, Integer, Long, String, Boolean, etc.) and user-defined types, events, and even assemblies. All objects inherits from the base class Object.
VB.NET is implemented by Microsoft's .NET framework.

VB.Net a widely used language:
·         Modern, general purpose.
·         Object oriented.
·         Component oriented.
·         Easy to learn.
·         Structured language.
·         It produces efficient programs.
·         It can be compiled on a variety of computer platforms.
·         Part of .Net Framework.

Programming Features VB.Net
VB.Net has numerous strong programming features that make it endearing to multitude of programmers worldwide. Let us mention some of these features:
·         Boolean Conditions
·         Automatic Garbage Collection
·         Standard Library
·         Assembly Versioning
·         Properties and Events
·         Delegates and Events Management
·         Easy-to-use Generics
·         Indexers
·         Conditional Compilation
·         Simple Multi-threading

.Net Framework Architecture

.NET is tiered, modular, and hierarchical. Each tier of the .NET Framework is a layer of abstraction. .NET languages are the top tier and the most abstracted level. The common language run-time is the bottom tier, the least abstracted, and closest to the native environment. This is important since the common language run-time works closely with the operating environment to manage .NET applications. The .NET Framework is partitioned into modules, each with its own distinct responsibility. Finally, since higher tiers request services only from the lower tiers, .NET is hierarchical. The architectural layout of the .NET Framework is illustrated in Figure 

The .NET Framework is a managed environment. The common language run-time monitors the execution of .NET applications and provides essential services. It manages memory, handles exceptions, ensures that applications are well-behaved, and much more.
Language interoperability is one goal of .NET. 
.NET languages share :
  • a common run-time (the common language runtime, a common class library) 
  • the Framework Class Library (FCL)
  •  a common component model
  • common types.

1. The common language runtime: 
The common language runtime  is the foundation of the .NET Framework. You can think of the runtime as an agent that manages code at execution time, providing core services such as memory management, thread management, and remoting, while also enforcing strict type safety and other forms of code accuracy that promote security and robustness. In fact, the concept of code management is a fundamental principle of the runtime. Code that targets the runtime is known as managed code, while code that does not target the runtime is known as unmanaged code.
Following are some benefits of the runtime:
·         Performance improvements.
·         The ability to easily use components developed in other languages.
·         Extensible types provided by a class library.
·    New language features such as inheritance, interfaces, and overloading for object-oriented programming; support for explicit free threading that allows creation of multithreaded, scalable applications; support for structured exception handling and custom attributes.
Additional runtime features include:
·         Cross-language integration, especially cross-language inheritance.
·         Garbage collection, which manages object lifetime so that reference counting is unnecessary.
·         Self-describing objects, which make using Interface Definition Language (IDL) unnecessary.
2. The class library: The class library, the other main component of the .NET Framework, is a comprehensive, object-oriented collection of reusable types that you can use to develop applications ranging from traditional command-line or graphical user interface (GUI) applications to applications based on the latest innovations provided by ASP.NET, such as Web Forms and XML Web services.
The .NET Framework can be hosted by unmanaged components that load the common language runtime into their processes and initiate the execution of managed code, thereby creating a software environment that can exploit both managed and unmanaged features.
The .NET Framework not only provides several runtime hosts, but also supports the development of third-party runtime hosts.
The following illustration shows the relationship of the common language runtime and the class library to your applications and to the overall system. The illustration also shows how managed code operates within a larger architecture.
You can use the .NET Framework to develop the following types of applications and services:
·         Console applications.
·         Windows GUI applications (Windows Forms).
·         ASP.NET applications.
·         XML Web services.
·         Windows services.
Common type system:
The common type system defines how types are declared, used, and managed in the runtime, and is also an important part of the runtime's support for cross-language integration. The common type system performs the following functions:
·         Establishes a framework that helps enable cross-language integration, type safety, and high performance code execution.
·         Provides an object-oriented model that supports the complete implementation of many programming languages.
 Defines rules that languages must follow, which helps ensure that objects written in different languages can interact with each other.



.NET Framework in context
Note:
  • Just-in-Time Compilation

Assemblies contain MSIL, which is converted into native binary and executed at runtime, using a process aptly named Just-in-Time compilation, or jitting. An assembly is subjected to two compilations. First, managed code is compiled to create the actual assembly. Managed compilers, such as csc and vbc,compile C# and VB.NET source code into an assembly that contains MSIL and metadata. Second, the assembly is compiled at load time, converting the MSIL into native binary that is optimized for the current platform and hardware.
When an assembly is jitted, an in-memory cache of the binary is created and executed. Just-in-Time compilers are called Jitters. There is a Jitter for each supported hardware architecture.
  • What is a managed language?

If someone wants to create Forth.NET, are there established guidelines? Common Language Specification (CLS) is a set of specifications or guidelines defining a .NET language. Shared specifications promote language interoperability. For example, CLS defines the common types of managed languages, which is a subset of the Common Type System (CTS). This removes the issue of marshaling, a major impediment when working between two languages.
  • MSIL

is a low-level language that all managed languages compile to instead of native binary. Using just-in-time compilation, at code execution, MSIL is converted into binary optimized both to the environment and the hardware. Since all managed languages ultimately become MSIL, there is a high degree of language interoperability in .NET.

2 comments: