Wednesday, January 19, 2011

BASIC Basics, a quick look at VB.NET

People often look at the idea of programming with the attitude, or mindset, that it is too difficult and complex to learn. This may have been the case years ago when computer programming was best to left to computer engineers and by those who designed specific computer platforms. But over the years, computer's have evolved and so have the languages that run them. Similar to spoken languages. For example, choose a random page of your favorite modern book and compare it to a random page of any text written by Shakespeare or Chaucer. The differences will be almost immediately clear. The same has happened to programming languages. There are two main categories of programming languages: low-level programming languages, and high-level programming languages.

Low-level programming languages are languages designed for specific, advanced tasks, and are generally do not resemble spoken language at all. High-level programming languages aim to provide programming languages that are similar to the spoken language.

The following code shows an example application that shows the output "Hello, whats up world?" in a console window, and then waits for the user to press a key before exiting.
  1. Module ExampleApplication
  2.  
  3.     Sub Main()
  4.  
  5.         ' This will write a line to the console.
  6.         Console.WriteLine("Hello, what's up world?")
  7.  
  8.         ' This will cause the console application to pause so we can see it't output. Not the best method, but works for this example.
  9.         Console.ReadLine()
  10.  
  11.     End Sub
  12.  
  13. End Module
* This source code was highlighted with Source Code Highlighter.
Looking at the code, you could probably guess what each line is, aside from maybe lines 1, 3, 11 and 13 (which will be described in a later posting). If you look at lines 6 and 9, it easy to understand what is going on.

On line 6 you could probably guess that were are going to 'write' "Hello, what's up world?" to the console. And that line 9 is going to read the next line inputed to the console. Since the program isn't using the new line for anything, it continues on to line 11 which ends that section of code, and then the program.

When the application is ran, you will see this on the screen:
The example application running.



No comments:

Post a Comment

I Break Code Where code gets done.
ASP.NET | HTML | SQL Server | VB.NET | Request A Topic |