Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 338: Computer Languages & Visual Basic.NET

Similar presentations


Presentation on theme: "CIS 338: Computer Languages & Visual Basic.NET"— Presentation transcript:

1 CIS 338: Computer Languages & Visual Basic.NET
Dr. Ralph D. Westfall October, 2011

2 What is Programming? program = list of steps for computer
like a recipe steps can be in different "languages" Java, Visual Basic, C++, etc. each language has own syntax (rules) like grammars in human languages “We ain't got no badges” (video; Wikip.)

3 Why Is Programming Hard?
a computer is very "stupid" it doesn't understand anything: you have to tell it exactly what to do have to follow all the rules (syntax) of the language as you are telling it what to do it takes a lot of practice to be able to tell the computer exactly what to do, in perfect syntax ["Simon says:"]

4 Computer Language Types
differences based on: low level vs. high level compiled vs. interpreted special purpose vs. general purpose procedural vs. object-oriented functional vs. imperative

5 Language Levels low level: machine language high level
language that a computer understands binary numbers e.g., or hex numbers e.g., a(=10), f(=15) demo: d, u [decimal address], q high level languages that people can understand words like "if," "else," "for," "true"

6 Language Levels - 2 1st generation : machine language
BFB (hex from DOS debugger) 2nd generation: assembler MOV DI,96B6 3rd generation: COBOL, FORTRAN, C 4th generation (“4GL,” usually used with databases): NOMAD (advertising hype) 5th generation? (Japanese artificial intelligence research project in ’80s)

7 Translation need to convert high level languages into a computer's machine language compiled all source code in a file converted into an object code file, then run by computer interpreted source code converted and run one line at a time

8 Translation - 2 some languages are both compiled and interpreted (e.g., VB 6) 1st compiled into "intermediate language" (like machine language) .NET languages (~60 groups, Iron) compile into MSIL (Microsoft Intermediate Language) cf. Java bytecode intermediate language then interpreted and executed by "run time" code (CLR)

9 Translation - 3 some interpreted languages can also be compiled
previous versions of Visual Basic were interpreted languages interpreter used to run when developing but distributed as a compiled EXE

10 Managed Code Managed code executes through a virtual machine
“unmanaged code … is executed directly by the computer's CPU” (Wikipedia used to say that) Java and .NET are based on managed code Advantages easier to work with better security

11 Special Purpose Languages
don't do everything do a few things very well example: markup languages HTML, XML display text, images, etc. do NOT do any calculations example: SQL for databases

12 General Purpose Languages
can be used many different kinds of applications FORTRAN: mathematical (and other) COBOL: business/accounting (and other) BASIC (before VB): an introductory language Pascal: to teach good programming

13 Procedural Languages one step after another
C, COBOL, BASIC (not VB.NET) data and actions (procedures) are separated example: plans for a large wedding data = list of all food & supplies procedures = all instructions for every part of the wedding

14 Object-Oriented Languages
newer approach to programming C++, Java, VB.NET data and procedures that use it are together in the same place (in an object or a class) objects can operate independently event-driven programs instead of one step after another

15 Object-Oriented Languages - 2
objects are like things in real world(?) e.g., car, cat, college have data (properties) & actions (methods) is a number an object? has a (single) value, but has numerous operations (things you can do with it) can you think of examples of operations on numbers?

16 Object-Oriented Languages - 3
encapsulation or "data hiding" can only access data through an object's procedures object is a "black box" VB.NET provides objects with encapsulated data e.g., to connect to a database can create your own classes in VB.NET and then instantiate objects from them

17 Object-Oriented Languages - 4
inheritance: new objects extend capabilities of parents HourlyEmployee inherits all properties and methods of Employee object VB used to be “the only ‘object-oriented language’ with no inheritance” (Bruce McKinney) VB.NET is a true object oriented language

18 Object-Oriented Advantages
objects are easier to understand ("everyone says") things in real world work like objects different objects can hook together like a digital Lego block system objects can be reused instead of "re-inventing the wheel"

19 Functional vs. Imperative
most common languages are imperative "side effects" can make code not run the same when other parts of the system differ functional programming languages should have fewer bugs Haskell and Erlang (used in telecommunications) are functional VB not but see VB Functional Programming

20 Visual Programming the Visual Studio.NET IDE is a visual environment, not a language multiple windows: program code properties debugging: locals and immediate manipulation capabilities drag and drop controls

21 VB 6 as a Language commonly referred to as a visual programming language but visual programming really means selecting symbols instead of writing words like creating a query in MS Access falls somewhere in between a 3rd and 4th generation language object based, not object oriented

22 VB.NET as a Language also somewhere in between 3rd and 4th generation
a truly object-oriented programming language has many features that are not in VB 6 copied from Java? inheritance, try/catch blocks, file output streams, etc.

23 Comparison with C# Top 10 reasons VB.NET better than C#
fewer data casts and conversions better Intellisense (autocompletion) optional parameters in subroutines With..End With construct event handlers require less coding less typing

24 Test Your Understanding
Visual Basic.NET is: low level or high level? compiled or interpreted or ... ? managed or unmanaged code? special purpose or general purpose? object oriented or ... ? functional or imperative?


Download ppt "CIS 338: Computer Languages & Visual Basic.NET"

Similar presentations


Ads by Google