0% found this document useful (0 votes)
60 views

Visual Programming Concepts and Development

This document gives a full description and understanding of visual programming concepts and how to develop programs using appropriate procedures.

Uploaded by

Basildon Shumba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Visual Programming Concepts and Development

This document gives a full description and understanding of visual programming concepts and how to develop programs using appropriate procedures.

Uploaded by

Basildon Shumba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Visual programming concepts and Development

Introduction
What is a programming language?

● In a computer system, instructions are written in machine


code.
● Computers only understand machine code.
● Because of the difficulty in understanding machine code,
high level languages have been created that can be easily
understood by humans e.g C , C# , Java, Vb.net etc
● A translator is needed to convert high level code to machine
code.
Compilers and interpreters

● Compilers are a type of translator that converts source code


into an object program.
● The object program is stored in an executable file (.exe in
Windows), which can be executed directly in a computer.
● The usage of a compiler can be summarized in the
● diagram(Figure 1):
Figure 1: Compilation process
Interpreter

● On the contrary, an interpreter reads the instructions one by


one, and execute each instruction immediately after reading
it.
● No object program is made by the interpreter.
● This approach may sound simpler, but its efficiency is
generally much lower than compilers because the same
program statement needs to be translated every time it is
run.
Byte code and Virtual machines

● In some programming languages, including Java and Visual


Basic.NET, programs are not directly compiled to machine
code.
● They are compiled to some intermediate representation
called bytecode.
● The generated bytecode is opened and executed by a virtual
machine (VM).
● A virtual machine is actually a translator of the bytecode,
which consists of an interpreter or a just-in-time (JIT)
compiler, or both.
Just In Time (JIT) compilation

● Just-in-time (JIT) compilation means doing the compilation at


run-time, instead of prior to execution.
● This is generally more efficient than interpreters because
compilation is only done once.
● However, there is a small delay at the start of execution
because of the compilation.
● Java, JavaScript and .NET framework are a few popular
systems that utilise JIT compilation.
Console applications

● Console applications are programs that are used via a text


only interface.
● The most popular console application is the “Command
Prompt” in Microsoft Windows.
● In contrast GUI applications make use of buttons, text boxes
, drop down menus etc.
Creating a new project

● After you start Visual Studio, select “New Project” in the File
menu. Select “Visual Basic” in the left pane, and then
“Console Application” in the right pane.
● Give the project a name (“ConsoleApplication1”), and then
press “Okay”.
● A project with a file called module1.vb will be created.
Adding code

● You can add code between Sub and End Sub


Running the program
The console object
Substitutions in the console

● If {0} , {1} , {2} , ...​ are found in the string, it is replaced by


following arguments (i.e.
● the things inside Console.WriteLine and the like, separated
by commas).
● Since the output string is the first argument, {0} is replaced
by the content of the second argument, {1} by the third
argument.
Sample code
The output
Reading from the console

● The Console.ReadLine method reads a line of characters


from the console and returns a string.
● To add a prompt, use Console.Write immediately before
Console.ReadLine.
Output

● If the user enters the value 100

You might also like