Programmeercursus O.O.P. met VISUAL BASIC.NET

Slides:



Advertisements
Verwante presentaties
KINN 2010 •OOP •O Object •O Georiënteerd •P Programmeren.
Advertisements

Document Management Silicon.
Software Architectuur Over de samenhang der dingen = Over de connecties tussen componenten Over de afhankelijkheden tussen modules Over de belangen van.
Server Management Framework
ANDRÉ OBELINK, MCSD, MVP Introductie.NET Framework 3.0.
Gegevensstructuren: list boxen en lijsten
Inleiding programmeren in C++ Life Science & Technology 19 januari Universiteit Leiden.
Objecten Hoofdstuk 6 Hoofdstuk 6 Hoofdstuk 6 1.
Inleiding Programmeren met Visual Basic Karl Moens.
Masterproef  onderwerp doorgeven :  Deadline : 30/09/10 (1 e en 2 e zit)  Erasmus  begeleiding,… in buitenland  enkel scriptie uploaden  niet-Erasmus.
Klassen en objecten.
Phoenix Contact ILC150ETH F. Rubben, Ing.. Phoenix Contact ILC150ETH F. Rubben, Ing.
Hoofdstuk 2 Hallo, C# !.
1 Toegepaste Informatica Keuzevak C++ 3°jaar. 2 Studiefiche  Software  Boek (hfst 3-5)  Presentatie (website)
De koektrommel of de grabbelton
1 Voorwaarden hergebruik Modulair ontwerp Low coupling High cohesion.
Herhaling: For, While en Do
Visual Basic .NET voor studenten
Consoleprogramma’s Hoofdstuk 19. Visual Basic.NET voor studenten2 In dit hoofdstuk … Hoe consoletoepassingen maken In- en uitvoer bij consoleprogramma’s.
Visual Basic.
Agentenplatformen en programmeeromgevingen 1.Java 2 Micro Edition (J2ME) 2.Personal Java 3.JADE en LEAP 4.LEAP op verschillende toestellen 5.Onze voorkeuren.
Visual Basic.Net - Overzicht
Presenteert:.
Web Applicaties Bouwen met Visual Studio .NET
Windows Applicaties Bouwen met Visual Studio.NET Sijmen Koffeman Development Consultant Microsoft.
Client-side scripting. 1.Scripting in webpagina’s 1. Verschillende talen VB: toepassingen in Windowsomgeving VBA: toepassingen in MS-Office VBScript internet.
Debugging en Tracing met Visual Basic.NET André Obelink, MCSD Visual Basic Groep.
Visual Basic 2010 – What’s new André Obelink
Keuzetraject Software Ontwikkeling. Marktvraag Mark Heeren (ceo CSC Benelux): –Nieuwe mensen aannemen wordt weer moeilijk, men stelt meer eisen over auto.
KINN 2010 OOP O Object O Georiënteerd P Programmeren.
Visual Basic.NET voor studenten De VB- ontwikkelomgeving Hoofdstuk 2.
PADS4 maakt het eenvoudig om informatie te verspreiden naar een specifiek publiek op de juiste plaats en het juiste moment PADS4 is een professionele oplossing.
Positie Optimalisaties Mobiele Multi-Agent Systemen Stand van zaken 2U.
Programmeerstijl Hoofdstuk 21. Visual Basic.NET voor studenten2 Inleiding Belang van een goede programmeerstijl:  Programma’s worden door meerdere mensen.
Debuggen Hoofdstuk 9 Hoofdstuk 9.
Datacommunicatie en netwerken
Programmeercursus O.O.P. met VISUAL BASIC.NET
Hoofdstuk 3 - Conditionele logica
Computertechniek 2 – ARM assembler Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  programma draaien vanuit ROM.
Tircms02-p les 3 Functies Strings Structuren. Functies 1. main() 2. { int k; k = 10 ; printf(“%d\n”,fac(k)); } 3. int fac(n) int n; 4. { int f; f= 1;
tircms02-p les 1 Operating Systems practicum
1 Introductie next MCT - Programmeren 2 © S. Walcarius Waarom java? programma machinetaal (.exe) compilen platformspecifiek Een exe programma.
© imec 2000 © imec 2001 MAX+PLUS II Installatieprocedure.
Spreadsheets. Testen. Met spreadsheets.. |  Spreadsheet, het meest gebruikte (test) tool in de wereld …  Aan de slag: Spreadsheet PRA  Risico’s en.
Polymorfie Hoofdstuk 24. Visual Basic.NET voor studenten2 Inleiding Polymorfie zorgt ervoor dat een gegeven object verschillende “vormen” kan aannemen.
Tircms03-p les 1 C++ voor C-kenners Voor Technische Informatica.
2 August SQL Les August Agenda Herhaling Herhaling Cursors Cursors MS SQL Server and MS Excel MS SQL Server and MS Excel Oefeningen.
W W W. N E D P O R T A L. N L Network-wide event log monitoring.
Node.js en NPM. Node.js Open source, crossplatform runtime omgeving voor server-side javascript applicaties, primair bedoel snelle, schaalbare netwerk.
Adapter voor industriële wireless sensor netwerken Student: Glen Vanroelen Interne promotor: Tim Dams Externe promotor: Kevin Heylen (Intation)
OOP en.NET. Objecten Is geen ‘nieuw’ mysterieus woord Overal om ons heen zien we objecten: – TV – Computer – Auto – Wasmachine – ….
C++ Les 1: introductie. Programmeren Programma’s scripts Websites libraries (Sound, GUI, netwerking…)
GUI & classes Een Gui in een class steken en het object gebruiken.
Demo DICTU Cloud Een kijkje onder de motorkap bij DICTU Cloud.
Windows applicatieontwikkeling
Software Development fundamentals
De programmeertaal C++
The Hybrid Workspace Gino van Essen Technical Consultant.
COINS Navigator 2.
ASP.NET MVC Web Development
Software Development fundamentals
Software Development fundamentals
COINS Navigator 2.
Microsoft Operations Management Suite (MOMS)
– Software development fundamentals
– Software development fundamentals
Windows applicatieontwikkeling
Software Development fundamentals
Software Development fundamentals
Software Development fundamentals
Transcript van de presentatie:

Programmeercursus O.O.P. met VISUAL BASIC.NET Frans Vanrillaer & John Evans

Wat is .NET .Net is het samen voegen van de ‘Common Language Runtime’ met een verzameling ‘.NET base classes’ . .Net laat ons: robuuste, foutvrije, aanpasbare, eenvoudig te installeren, goed te onderhouden, taal onafhankelijke, aangepast aan de moderne technologie, Programma’s ontwikkelen.

Algemeen overzicht software scenario’s Applicatie Types Ontwikkelings Model Intelligentie plaats

Ontwikkelings Model Cliënt Database Cliënt Server Database Server One cannot appreciate .NET just by understanding its numerous features. To understand it in its correct perspective and realize what it is driving at one must take a broader look at what it is trying to address. So let us take a bird's eye-view of the overall software scenario. Firstly we need to understand what is the software development model that is adapted today and the problems that it faces. Secondly, we need to take a look at what different types of software applications are used today and what are the major concerns in developing these applications. Thirdly, we also need to a look at the places where the intelligence of the software application lies from a hardware perspective. Internet Explorer Outlook Express Cute FTP IIS MS Exchange Configured IIS MS Word MS Excel Spell Checker Charting Comp.

Applicatie Types Word Windows Apps Excel Scheduler.dll Componenten Lib Chartmaster.dll Web Apps Elke Home page E-Commerce Site Distributie Apps Banking Applicatie E-Commerce Applicatie Mobile Apps Trip-Planner Pocket-Reminder Real-Time Emb. Apps Flight Controller Engine Controller

Intelligentie Plaats Mainframe Domme Terminal Intelligente Server PC With Intelligence I mean the shift which is happening over the years. In the Mainframe model there is an Intelligent server and number of dumb terminals acting as clients connected to the Intelligent server. All the processing is done on the server with clients acting merely as an interface to the server. Thus intelligence is concentrated on the server. In case of PCs one machine acts like a server as well as client. All the parts of the software are on the single machine. Hence intelligence lies only one machine. With the advent of LANs once again an intelligence shift happened once again. In a LAN intelligence lies on both client as well as server. This distribution is more or less equal. If you take a look at the Internet model the intelligence has once again been shifted back on the server. Clients are not like dumb terminals. Instead they have an application like browser that allows us to interact with the server applications. They can be called "not so dumb" terminals. De Twee samen Netwerk Intelligente ? Intelligente ?

De .NET oplossing .NET Framework .NET Servers Ontwikkelings omgeving CLR Base Classes SQL Server BizTalk Server Commerce Server Exchange Server ISA Server Mobile IIS CLR = Common Language Runtime BCL = Base Class Library FCL = Frame Class Library Visual Studio.Net Één ontwikkelings omgeving (IDE ) voor alle software types en alle .Net talen

.NET Interne opbouw Taal Infrastructuur Common Type System VB.NET C# VC++.NET J#.NET JScript ……. Common Type System Type declaratie (waarde of referentie) Type management (stack of heap) Basis functies volgens Object-Oriented Model Implementatie regels voor nieuwe talen (CLS Common Language Specification) A developer can pick the .NET language that he likes most, write components in it, and share the compiled binary version of his component with other developers using other .NET languages. As on date there are 22 languages including VB.NET, VC++.NET, C#, COBOL, etc. from which the programmer can choose. Microsoft has made the specifications for .NET development platform freely available to compiler vendors in the form of Common Language Infrastructure (CLI). Vendors can develop compilers that produce standard binary code conforming to the CLI. CLI proposes a Common Type System which in turn contains Common Language Specification (CLS). The Common Type System defines how types are declared, used, and managed in the runtime. The common type system performs the following functions: · Defines how types should be declared (value or reference) and how they should be managed (stack or heap). · Provides base types in object-oriented form for languages to implement. · Defines rules that languages must follow, which helps ensure that types written in different languages can interact with each other. These rules are defined under the CLS. All .NET compliant languages have to follow the rules laid down by CLS to be truly interoperable. Some of these rules are listed below: Global variables and methods are not interoperable. If two variables are to be considered distinct, they must differ by more than just their case. Single type and name should not be used for a method and a variable. All dimensions of an array must have a zero lower bound. etc.

.NET Interne opbouw Programming Model Common Type System Client-Side VB.NET C# VC++.NET J#.NET JScript ……. Common Type System Client-Side Server-Side Mobile-Side WinForms WinForm Controls Rich Client Apps. Components Windows Services WebForms WebForm Controls WebServices Mobile WebForms Smart Clients Real-Time Apps. Now that we understand how .NET is able to provide true language interoperability without loosing important features of OO, let us now take a look at the differnet applications that one can develop in .NET using the same programming model and a single .NET compliant language. The slide lists various applications under different heads. The elegance of .NET is that if a form (WinForm) has been designed in C#, one can either use it as it is or inherit that form to add some more functionality before displaying it. This is known as Visual Inheritance. .NET has extended the WinForm technology to the Rich Client applications. Unlike Java Applets and Applications where one has to alter the code while converting an applet to an application or vice versa, the same WinForm can be used directly on the Web too. WinForm when used on Web runs under a secured environment on the client side without danger of accessing the client machine resources. WinForm controls as compared to ActiveX controls can now be easily developed (by just inheriting a class) and can be used in the different languages. A class library can be developed without any problem of DLL Hell or a deployment nightmare. This is because .NET components are fully self-describing without any dependencies on separate files. They can be conveniently versioned and accessed depending on the version number. Web applications can now be developed as easily and consistently as Windows applications. WebForms can be designed by drag and drop method. Events from the controls can be linked to handlers in the code. The output of the WebForm is displayed in the browser on the client-side, whereas, handlers for buttons and other controls execute on the server. WebForm controls like WinForm controls can be easily developed. Creation of Mobile WebForms is also possible through simple drag and drop. WebServices extend the vision of distributed computing as they use the existing infrastructure of the Web as well as standard protocols. Mobile applications can now be easily developed with the introduction of .NET Compact Framework. It is also possible to develop Hard Real-Time applications with the introduction of Windows CE.NET.

.NET Interne opbouw Base Class Library Common Type System Client-Side VB.NET C# VC++.NET J#.NET JScript ……. Common Type System Client-Side Server-Side Mobile-Side Base Class Library The .NET Framework includes a rich set of classes that provides the comprehensive functionality for any type of application one intends to develop. The applications that we saw in the previous slide would need functionalities like messaging, database access, security, drawing, and many more. All these functionalities can be provided through the classes present in the base class library. All the classes in the Framework Class Library are organized in different namespaces. GDI+ Networking Threading Web Protocols Messaging Serialization Security Reflection Timers ADO.NET Windowing

Common Language Runtime .NET Interne opbouw Runtime VB.NET C# VC++.NET J#.NET JScript ……. Common Type System Client-Side Server-Side Mobile-Side Base Class Library Once an application is developed and executed the runtime takes care of it. .NET provides a enhanced runtime, as compared to the one provided by Windows, which comprises of the components listed in the slide. When a .NET compliant language compiler compiles the source code it emits code in intermediate language (IL). This code is processor independent code. The Just-In-Time (JIT) Compiler that the Common Language Runtime (CLR) provides compiles this code to the processor specific code (native code) which is then executed. The advantage of the IL is that it can be executed wherever .NET is present. Hence if .NET runtime is ported on different operating systems our code would get automatically ported on those operating systems. Also, it increases the performance of the applications because when JIT compiles IL to the native code it emits the code that is efficient for the underlying processor. CLR handles object creation and destruction and hence relieves programmer from destroying the objects explicitly.CLR releases the object when they are no longer being used. Automatic memory management eliminates memory leaks as well as some other common programming errors. CLR also handles runtime errors and informs the concerned application about them. CLR also provides a secured environment when a WinForm application is downloaded from the Web Server. It also checks for the integrity of components when they are loaded. It also checks for the type safety when types are accessed from different applications. CLR extends the Windows runtime concept of process by providing application domains. This allows multiple EXEs to run within the same process, but in different application domains without the risk of interference and at a considerably improved performance. Common Language Runtime Just In Time Comp. Garbage Collection Class loading Secure environment Handling Exceptions Application Domains

Common Language Runtime .NET Interne opbouw Platform VB.NET C# VC++.NET J#.NET JScript ……. Common Type System Client-Side Server-Side Mobile-Side Base Class Library In spite of all the enhancements and power that the framework comprises, at the core it runs on Windows. The framework uses the functionality provided by Windows which is listed in the slide. The framework also provides services that are needed by enterprise applications and mission-critical applications. Since such services are provided by COM+, the framework borrows them from COM+. The services are listed in the slide. Common Language Runtime Windows COM+ Services Transaction support Message Queuing Object Pooling Load Balancing GUI Multitasking Event driven model

Common Language Runtime .NET Interne opbouw .NET Framework VB.NET C# VC++.NET J#.NET JScript ……. Common Type System Client-Side Server-Side Mobile-Side .Net Framework Base Class Library Common Language Runtime Windows COM+ Services Windows 2000 / NT / XP

.NET Interne opbouw Hoe het werkt Uitvoering onder CLR VB.Net Source Code IL Compiler Linker C# Source Code IL Compiler EXE of DLL Having understood the details of the .NET framework let us take a overview of the way a .NET based program works. Once our code is written, we compile it, and the compiler translates it to Microsoft Intermediate Language (MSIL). MSIL is a CPU-independent set of instructions that can be efficiently converted to native (CPU dependent) code. MSIL code is a language independent code. The Linker then links the IL code converted by one language compiler with the IL code compiled by another language compiler. The result is an EXE or DLL, containing the IL code, which is saved to disk. VS.NET comes with different language compilers to generate IL code. During execution the IL code and any requested functionality from the .NET base classes is brought together. The Just In Time (JIT) compiler processes the combined code creating managed native code (code that targets the runtime is called managed code) which is passed to the CLR. The runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used. Class Library JIT Compiler Uitvoering onder CLR Native Code

.NET Interne opbouw Algemeen Overzicht

VB.NET Console applicatie maken Start Visual Studio File | New | Project Selecteer: Console Application Vul naam in: voorbeeld1 Geef locatie Klik Ok Creëert : Module Module1

Console Applicatie Automatische Code Imports System Module Module1 We maken het ons gemakkelijk en importeren expliciet de namespace System Noodzakelijk begin Keyword van een Module Naam vd Module Wordt meestal geweizigd Module Module1 Start naam Sub Main( ) Begin Keyword van een Subroutine Console.WriteLine ( "Hello VB.NET" ) Class van System Functie van deze Class End Sub End Module Sluit Subroutine af Sluit Module af Klik ‘F5’ of L-muis klik op:

Console Applicatie Met Command-Line Argumenten 1/2 Pas de code als volgt aan : Module Module1 Sub Main ( ByVal args( ) As String ) Dim s As String For Each s In args Console.WriteLine ( s ) Next End Sub End Module Imports System Om deze code te RUNNEN Select Start | Uitvoeren zoek met Browse naar het programma in de bin folder klik en type Frans Jan Nadine, dan klik OK. Andere manier We can stretch the first program done above to add the ability of printing the command-line arguments that may be supplied while executing the program. The enhanced program is shown in the slide. There are two ways of supplying command line arguments to a program: - Select Start | Run from menu item following the program name with the arguments that we intend to provide . - Alternatively right click on the project name from the Solution Explorer. Select properties. A property page would be displayed. Click on the configuration properties and select the debugging option from it. Supply the command line arguments. The For Each loop walks through the args( ) array printing each command-line argument in the process.

Console Applicatie Met Command-Line Argumenten 2/2 R

Overzicht volgende Les Datatypes Controle Structuren Proceduren Option Strict Type Conversie ByVal/ByRef Meerdere Modules