Visual Basic Programming Language - Project | CSC 415, Study Guides, Projects, Research of Programming Languages

Material Type: Project; Professor: Lyle; Class: Programming Languages; Subject: CSC Computer Science; University: Murray State University; Term: Fall 2009;

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 02/25/2010

koofers-user-c0n-1
koofers-user-c0n-1 🇺🇸

7 documents

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Badger 1
Visual Basic
Charles R. Badger
CSC 415: Programming Languages
Dr. Lyle
November 7, 2009
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Visual Basic Programming Language - Project | CSC 415 and more Study Guides, Projects, Research Programming Languages in PDF only on Docsity!

Visual Basic

Charles R. Badger

CSC 415: Programming Languages

Dr. Lyle

November 7, 2009

History of Visual Basic In early March of 1988, Alan Cooper, also known as the “father” of Visual Basic, sold a program called Tripod to Microsoft. Tripod was a drag-and-drop shell prototype that was renamed by Microsoft, Ruby. It included a widget control box that can also add more widgets dynamically, and a small language engine. In March of 1991 Microsoft combines the Ruby shell application to QuickBasic and gave it a new name: Thunder. This new combination was the first tool to allow the user to create applications easily, quickly and visually. There was the famous drag-and-drop control box, codeless UI creation, and an event oriented programming model. In March of 1992 the Visual Basic 2.0 toolkit was released, it integrated several third-party tools into a single package. It gave VB developers controls for the first time, and it helped Visual Basic’s third party market achieve critical mass. In November of 1992 Visual Basic is upgraded to making it easier to use. I brings a combination of extensibility, ease-of-use and visual point-and-click emphasis to a relational database. It also gained the Macro language called Access BASIC, which has a subset of VB 2.0’s core syntax. In June of 1993 Visual Basic 3 came out with additions such as; integrating the Access Engine (Jet), OLE Automation and reporting. In fall of 1996 it had VBScript, and it let developers leverage their existing Visual Basic skills in web programming. When October of 1996 came around Visual Basic 4 came out with permissions to allow you to create your own add-ons. Then in April 1997 Visual Basic 5 came out, it had the ability to create ActiveX controls, it incorporates the compiler, WithEvents, it also had a small upgrade that was free to

integer. A Single data type is a 32-bit floating-point number; this is used mainly for fractional numbers. A String data type is a group of characters that is grouped together based on the variable-length. The String is mostly used when text is involved. A Char is a single character, for example; &, !, and any other single character spaces or keys. An Object is a data type that has its own class. Any type can be stored in a variable of type Object. An SByte is basically a VERY small integer, defaulted at 0. It is also known as a Short which is the same thing. The UInteger is the largest unsigned value in the most efficient data width. The UShort is the shorter version of the UInteger, it is just like the case of the Short being smaller than the Integer. The ULong is basically the largest version of the UInteger, just like the Long is the largest version of the Integer. The User-Defined data type is actually a structure, it depends on implementing platform. The user-defined data type, when structured it is made up of many different data types inside of it, it treats a structure as a single unit and can also access the data types inside the structure. Each member of the structure has a range determined by its data type and independent of the ranges of the other members. Design, Syntax and Semantics

Binding

There are two types of Binding , early and late. Early binding is when the compiler is able to perform type and syntax checks to make sure that the correct number and parameters are passed to the method and that the return value will be the expected type. And late binding is where it waits for run time to bind the property and method calls to their objects. Even though

early binding is faster than late binding the performance difference in comparison with early to late is that early binding is often negligible. Scope “The scope of a declared element is the set of all code that can refer to it without qualifying its name or making it available through an Imports Statement” (msdn.microsoft.com/…/1t0wsc67.aspx). There are 4 types of scope; Block, Procedure, Module, and Namespace. Block scope is only available in the code block where it is declared, it is also the narrowest form of scope. A block scope is a set of statements inside the initiating and terminating declaration statements. Some examples are; do and loop , If and End If , and Try and End Try. Procedure Scope is for all code that is inside the procedure that it is declared in. An easier way of saying it is, it is an element in a procedure that can only be used within that procedure, also called a “local variable”. Module Scope is an element that can be outside a procedure but must be within the module, class, or structure. A perfect example is a private class, it is available to be used within that module but it can’t be used by anything outside of that. Namespace Scope is the widest scope, when public is put in front of an element it is free to be used or implemented by any procedure or any part of the program.

Expressions

Expressions are a group of values or value elements that are combined using operators to create a whole new value. Operators consist of 4 different types; arithmetic, comparison, concatenation, and logical and bitwise operators. A perfect example of an arithmetic expression is “x=x+3”, a good example of a comparison operator is “x>1”, an

S2a; S2b end else if E3 then S else if E4 then S else begin S5a; S5b; end; The Case statement is also called “switch” for c/c++/java; the benefit of the case statement is that it can be more efficiently implemented than any tests in a multiway if statement. The case statement provides basically a better version of the multiway if; a better multiway branching, however based on the value of a certain expression. There are condition-based iteration which refers to a loop continuation or loop termination , and a while loop or do-while loop. The loop continuation and loop termination is based on the evaluation of Boolean conditions; the while loop is a test occurring at the beginning of the loop, and the do-while loop is where the test occurs at the end of the loop. And then the indexed iteration, which refers to the for loop ; which is used in such a way to allow a loop to run within a specified range of integer values.

Subprograms

Subprograms are an essential part of programming. A subprogram is used in such a way to basically make something happen in the program in a miniprogram, but that program can’t run unless called on by the main program. An example would be the “swap” subprogram, the subprogram simply makes two variables swap values; but when there are multiple variables being concluded and certain ones need swapping with others, it just calls the “swap subprogram” to swap whatever specific variables that need swapping. They are used in every

programming language, there are only two types: functions, and procedures. A function is the same as a subprogram but it can return a value. A sub procedure is a group of instructions (also known as code) that can be performed as one group. So basically it is a smaller version or a piece of the bigger program that helps cut back on code, since it is mainly used to be repeatedly called in other parts of the one program. Object-Orientated Programming Visual Basic.NET is a fully object-oriented programming language, which means it supports the four basic tenets of object-oriented programming: Abstraction, Encapsulation, Inheritance, and Polymorphism.”(page 3 of Object-oriented programming with Visual Basic.NET by J.P. Hamilton, oreilly.com).

Abstraction

Abstract Data Types , in VB.NET are referred to as “Classes”, are basically self made/user made data type, it also has specific words built in the program, but the code for it is somewhere else. The ADT is a data type defined by the programmer that describes a type of data and all the operations that can be performed by the ADT. A better way of putting it is what is said by Michael McMillan on page 55 in the book, Object-oriented programming with Visual Basic.NET, “An Abstract data type (ADT) is a data type that defines both the data of the type and the data operations allowed by the type. An ADT is a user-defined data type that is defined in an implementation-independent way so that the ‘what’ of the ADT is communicated to the programmer, who can then implement the ADT using any programming language, he or she chooses.”

Encapsulation

MustInherit are those three word modifiers. Inherit is the statement that specifies the base class. NotInheritable is the statement that literally means that the statement or code is not capable of being inherited. MustInherit statement is the one that requires an inheritance. A good example of inheritance is: Class 1 Interface 1 Method1() Class 2 Interface 2 inherits Interface 1 Method2() Method1()

Polymorphism

Polymorphism , as long as an object gets a message it understands, the object can know what appropriate “actions” to take. Different objects might take different “actions” even though they are sent the same message, and this is because they implement inherited methods differently. Most Object-oriented programming languages need inheritance to implement polymorphism. However, with Visual Basic.NET, it doesn’t use inheritance to implement polymorphism; VB.Net uses multiple exposed ActiveX control interfaces to implement polymorphism. ActiveX controls are reusable software components that execute functions independently of the program language used to implement them. Active X is used in this case for customized applications that gather data, types of files, and displaying animation.

Concurrency

Concurrency , in one case, is usually run into when two different users are trying to modify the same database data at the same time, which that causes concurrency conflicts. There are also four different levels when in software execution. The instruction level is when two or more machine instructions are being executed at the same time. Statement level which

is in execution there are more than one source language statements being executed at the same time. The unite level is where more than one subprograms are running at the same time. The program level is when two or more programs are being executed at the same time. There are two types of concurrency; pessimistic concurrency and optimistic concurrency. Pessimistic concurrency, also called “locking”, this prevents user 2 from overwriting the modifications of user 1. It does this by never letting the whole situation get to that point. So it “locks” whatever data is being modified by user 1 from user 2 until user 1 is either finished modifying it or has released the lock on the data. The only back fire to this, is the extra overhead of the constantly managing the data locks, which would be a need for a continuous connection to the database. This is a lack of scalability, which is that users may end up locking data and records for seconds or minutes or for a while. Optimistic concurrency is when the data is locked but for a very short time, when the data is actually being modified. This avoids the issue that pessimistic concurrency has with the locking management, and the problem of scalability. It is also great for even when the user is modifying and disconnected from the database. However, there is also one flaw to this form of concurrency, when user 2 comes to modify what has already been modified by user 1. There are different ways to “fix” that problem, but the probable best way to fix it is have a detection of a concurrency violation. And allow a timer for how long the piece of data can remained locked after being modified by user 1, then once the time is up to allow re-modification if needed. The Where clause is what is used in Visual Basic, it is very useful for detecting concurrency conflicts. So when there is a possible concurrency conflict the WHERE clause is

Event Handling is when the event is connected to an object on the form, like a button, when it is clicked that is the event “click” and then the program does whatever is in the code section of that event. There are three general events that take place in VB.NET and then there are more specific ones within these general events. Keyboard Events, is when a key on the keyboard is pressed, an event occurs. Mouse Events is when one of the mouse buttons is pressed, and event occurs. Program Events, is when any code/program that runs at the start or is started by another event; for example when the up button on the keyboard is pressed the car on the screen speeds up, but when the button is let go the car starts slowing down. So in that example two events are happening, a key is being pressed (keyboard event) that causes the car to speed up (program event) and when the key is let go the program event “turns off”. Evaluation of Visual Basic The last part of this report will be my evaluation of Visual Basic. This evaluation will be based on four different evaluations: readability, writability, reliability, and cost.

Readability

The exception handling and event handling for VB.Net makes it easy to read and understand when a chunk of code needs to be checked. VB has a huge variety of code that can be used, but because of its help bar that pops up when typing code or when code is written it is easy to understand the code because it is mostly words used to execute, not some sequence of numbers and lines to cause an event to happen. This programming language has so much code going on in the back ground, and the object-orientation’s use allows for easy reading when trying to read and understand what is going on in the program.

Writability

Because of its object-orientation it makes it easier to use for those who can’t write code very well, but it has just enough code requirements in it to satisfy the programmer. One of the things that make it so easy for users when building a program using VB.NET is all that extra code that is going on in the back ground when a form is being custom created. The code to “create” a button is going on in the background so that all the user has to do is drag and drop on the form. The only code that would need to be modified is the event of whatever object is on the form, for example; when a button is put on the form the only code modification that is required is the event of the button. So if the button was supposed to close the form when running, the event code would be put in the event of the button when clicked so that it would then close the form (example: this.close()). So all the code running in the back ground makes this program extremely easy to read and understand for even someone who isn’t a programmer.

Reliability

The only problem with the coding is its reliability. It is reliable in a sense that even a small portion of the code is wrong it won’t work. Where it loses its reliability is, if there is something wrong with the code and the user allows it to continue anyway it will only load up the former coded part to make it work so that the programmer can see it, and sometimes some people don’t realize the error. Also if you don’t tell it to clear the variable it will leave the variable the way it is for the next time you open the program. So with that you have to have it reset the variables, it won’t do that automatically.

Cost

Bibliography for Visual Basic: History: http://en.wikipedia.org/wiki/Visual_Basic http://www.startvbdotnet.com/dotnet/vb.aspx http://www.johnsmiley.com/visualbasic/vbhistory.htm Overview things: Binding: http://support.microsoft.com/kb/ http://kandkconsulting.tripod.com/VB/Tutorials/vb_binding_tutorial.htm http://www.codeproject.com/KB/grid/BindingCollectionDataGrid.aspx http://www.bigresource.com/VB-binding-datagrid-at-run-time-cUfNgVmJFA.html Scopes: http://msdn.microsoft.com/en-us/library/1t0wsc67.aspx http://msdn.microsoft.com/en-us/library/bybkyxaz%28VS.71%29.aspx http://www.dummies.com/how-to/content/understanding-scope-in-visual-basic-net.html http://www.vb6.us/tutorials/vb6-variable-scope Data Types: http://msdn.microsoft.com/en-us/library/47zceaw7.aspx http://msdn.microsoft.com/en-us/library/ffsdktda%28VS.80%29.aspx http://www.rentron.com/datatypes.htm Expressions and Assignment Statements: http://msdn.microsoft.com/en-us/library/a1w3te48%28VS.80%29.aspx http://msdn.microsoft.com/en-us/library/099a40t6%28VS.71%29.aspx http://msdn.microsoft.com/en-us/library/z2wkh0tk%28VS.71%29.aspx http://msdn.microsoft.com/en-us/library/z2wkh0tk%28VS.80%29.aspx http://msdn.microsoft.com/en-us/library/wz3k228a%28VS.80%29.aspx Statement-level Control Structures: http://www.cs.sfu.ca/~cameron/Teaching/383/statement-control.html Subprograms: http://members.tripod.com/acha_ean/vb_12_lession/vel15.htm http://books.google.com/books? id=ulfe8QKi6B4C&pg=PA32&lpg=PA32&dq=visual+basic+subprograms&source=bl&ots=pEF Bl1_s6k&sig=IvwQYPIwHgUTf89PT_Mja- aCTMs&hl=en&ei=lU3BSrrqBoya8AbXiq2lAQ&sa=X&oi=book_result&ct=result&resnum=7# v=onepage&q=visual%20basic%20subprograms&f=false http://www.maconstateit.net/Tutorials/VBNET/VBNET02/vbnet02-01.aspx http://www.go4expert.com/forums/showthread.php? s=51f72c87ab6fde69521d0f5d9b6d870d&t= http://www.2000trainers.com/visual-basic/vb-functions-subprocedures/

Abstract Data Types: http://books.google.com/books?id=- o8pY9B0IwkC&pg=PA679&lpg=PA679&dq=visual+basic+abstract+data+types&source=bl&ot s=dBSCB2knHd&sig=Boy_yjrUvmlfhO97TAm0WSnnhIU&hl=en&ei=x03BSurjL4nU8Aaqxd mmAQ&sa=X&oi=book_result&ct=result&resnum=2#v=onepage&q=visual%20basic %20abstract%20data%20types&f=false (pg. 679) http://www.informit.com/articles/article.aspx?p= http://blog.matthewdoig.com/?tag=abstract-data-types Encapsulation Constructs: http://www.developerfusion.com/article/80/visual-studio-next-generation-language- enhancements/5/ http://books.google.com/books? id=kVqB5hjNsScC&pg=PA346&lpg=PA346&dq=visual+basic+encapsulation+constructs&sour ce=bl&ots=17WzqBTPZD&sig=xNxWbocQq-QHEst4qoSD_5O_FlU&hl=en&ei=5U3BSr- yJYGY8AaD5LWdAQ&sa=X&oi=book_result&ct=result&resnum=5#v=onepage&q=&f=false http://vb.mvps.org/hardcore/html/encapsulation.htm Support for Object-oriented Programming: http://oreilly.com/catalog/9780596001469/preview http://msdn.microsoft.com/en-us/library/55yzhfb2.aspx http://www.techotopia.com/index.php/Object_Oriented_Programming_with_Visual_Basic http://www.informit.com/articles/article.aspx?p= http://www.stardeveloper.com/articles/display.html?article=2001082201&page= http://www.informit.com/articles/article.aspx?p= http://support.microsoft.com/kb/ http://msdn.microsoft.com/en-us/library/c8shwxa5%28VS.80%29.aspx Concurrency: http://books.google.com/books? id=9XRYIxDDiNYC&pg=PA266&lpg=PA266&dq=what+is+concurrency+in+visual+basic&so urce=bl&ots=YX7lNCGEyj&sig=- EJYA7DnICZMWQBObFPtDnxKRLY&hl=en&ei=U3bBSo3KNZLh8QbrjpGRBg&sa=X&oi= book_result&ct=result&resnum=8#v=onepage&q=what%20is%20concurrency%20in%20visual %20basic&f=false (pg. 266) http://visualstudiomagazine.com/Articles/2009/05/27/Handling-Concurrency-with-Entity- Framework.aspx Exception Handling: http://msdn.microsoft.com/en-us/library/aa289505%28VS.71%29.aspx http://support.microsoft.com/kb/ http://msdn.microsoft.com/en-us/library/s6da8809%28VS.80%29.aspx http://www.java2s.com/Tutorial/VB/0140__Development/ BasicsofVisualBasicexceptionhandling.htm