200 likes | 397 Views
An Overview of Visual Basic .NET. Visual Basic .NET Environment. Visual Basic .NET Program. A Brief History of Programming Languages. Computers still rely on human beings to give them directions
E N D
A Brief History of Programming Languages • Computers still rely on human beings to give them directions • These directions are called programs, and the people who write the programs are called programmers • Just as human beings communicate with each other through the use of languages such as English, Spanish, Hindi, and Chinese, programmers use a variety of special languages, called programming languages, to communicate with the computer
Machine Languages – Remember ICT? • Within a computer, data are represented by microscopic electronic switches that can be either off or on • The off switch is designated by a 0 • The on switch is designated by a 1 • Instructions written in 0s and 1s are called machine language or machine code • Machine languages represent the only way to communicate directly with the computer
Assembly Languages - slightly more advanced • Assembly languages simplify the programmer’s job by allowing the programmer to use mnemonics which are converted into machine code—the 0s and 1s the computer can understand • Mnemonics are memory aids—in this case, alphabetic abbreviations for instructions • Programs written in an assembly language require an assembler
High-Level Languages – the next step up • High-level languages allow the programmer to use instructions that more closely resemble the English language • Programs written in a high-level language require either an interpreter or a compiler to convert the instructions into 0s and 1s • Like assemblers, both interpreters and compilers are separate programs
Interpreters vs. Compilers • An interpreter translates the high-level instructions into machine code, line by line, as the program is running • A compiler translates the entire program into machine code before running the program
Procedure-Oriented High-Level Languages • The programmer determines and controls the order in which the computer processes the instructions • Examples include: • BASIC (Beginner’s All-Purpose Symbolic Instruction Code) • C • Some of the procedure-oriented high-level languages—for example, the BASIC language—do not require a great amount of technical expertise to write simple programs
The Introduction of Windows • Windows software provides an easy-to-use graphical user interface (GUI) • Although the standard interface found in all Windows applications makes the user’s life much easier, it complicates the programmer’s life a great deal - it could take countless hours to write instructions creating buttons, scroll bars, and menus for all Windows applications
Object-Oriented/Event-Driven High-Level Languages – windows programming • In object-oriented/event-driven languages, the emphasis of a program is on the objects included in the user interface (such as scroll bars and buttons) and the events (such as scrolling and clicking) that occur when those objects are used • The ability to use objects that model things found in the real world makes problem solving much easier
Visual Basic • Visual Basic .NET is an object-oriented/event-driven programming language that is easy enough for a nonprogrammer to use, yet sophisticated enough to be used by professional programmers • With Visual Basic it takes just a few clicks of the mouse to include standard Windows objects such as buttons, list boxes, scroll bars, and icons in your Windows application
Attributes (Data) Brand Model number Dial Hour hand Minute hand Movement Behaviors Track time Track date Illuminate dial Blueprint of a Basic Watch – Basic Watch Class
Attributes (Data) Basic Watch attributes Alarm Behaviors Basic Watch behaviors Ring alarm Blueprint of a Basic Watch with Alarm
Attributes (Data) Behaviors Now you try …Blueprint of a Dog – Dog Class
OOP Terminology • OOP is an acronym for object-oriented programming • It means that you are using an object-oriented language to create a program that contains one or more objects • OOD is an acronym for object-oriented design • Like top-down design, which is used to plan procedure-oriented programs, OOD is also a design methodology, but it is used to plan object-oriented programs by dividing a problem into one or more objects
Object Examples: menus, radio buttons, and buttons included in most Windows programs An Object: • Is anything that can be seen or touched • Has attributes that describe it - characteristics • Has behaviors that the object can either perform or have performed on it - actions
OOP Terminology • A class is a pattern or blueprint used to create an object (every object in OOP comes from a class ) • A class contains—or, in OOP terms, it encapsulates—all of the attributes and behaviors that describe the object the class creates • Objects created from a class are referred to as instances of the class, and are said to be “instantiated” from the class • Abstraction refers to the hiding of the internal details of an object from the user which helps prevent the user from making inadvertent changes to the object
More OOP Terminology • Inheritance Examples: a particular type of watch or dog • Allows you to create one class from another class • The new class is called the derived class inheriting all attributes and behaviors of the original class • The original class is called the base class • Polymorphism is the object-oriented feature that allows the same instruction to be carried out differently depending on the object