Modern Programming Language Concepts

Started by Donald Darden, May 09, 2008, 03:35:10 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Donald Darden

Moving to VB6, RealBasic, kbasic, or Java from a background in something like QBasic, PowerBasic, or FreeBasic can be a bit daunting.  The reason is apparently OOP, or Object Oriented Programming.  This represents a whole new way of thinking about how to program, and making the code more modular, date-centric, and in many cases, event-driven.  In contrast, the older languages were primarily procedure-oriented, monolistic, and structured for specific tasks.

You can still combine the older methods with the new capabilities found in a modern programming language, but that still puts the onus on you to get up to speed with the terms and concepts advanced within that language.  If you don't do this, then it would be much like a one-legged running competing in a marathon race.  You may finish, but your handicap will keep you near the back.

I am not speaking as an expert here.  Heck, I'm still struggling to come to terms with modern languages as well.  But that makes me more sympathetic with the problem that others face.  So let's start with some online references to get us all started.

Object-Oriented Programming Concepts

Basic Concepts of OOP

Introduction to Object Oriented Programming Concepts (OOP) and More

Object Oriented Programming (OOP)

Object-Oriented Programming in Visual Basic .NET

VB Object-Oriented Development Page

Visual Basic Syntax

Inheritance Syntax

VB Object Syntax Introduction

Object Oriented Programming in Visual Basic

Making Object-Oriented Programs with Visual Basic

What I am attempting to do here is first, make people aware of the general idea of Object Orientation, and some of the properties associated with this topic.

Then the second step is to expose those same people to the terms or names involved, and a chance to read up on the concepts that underly them.

The next thing I believe should be relationships.  Programs are built up of many statements, of which the majority build on preliminary work done by earlier statements.  If this were not true, then most programs would be one-liners.  We also find that the relationship between certain sets of statements are so strong that they must. as a rule, be used in a certain sequence.

The point then is to look for example code to illustrate these relationships, because a lot of efforts to explain commands and options do not really focus on the implicit relationships until they get to coding examples.

A big problem here is not just learning concepts, but learning the syntax rules for implementing those concepts.  You have to understand the syntax rules to be able to understand the examples, and you have to remember them well enough to be able to use them when you write your own code.

Donald Darden

Different languages have different features, different keywords, different operators, and different syntax rules.  Even products that claim to be related, such as the various flavors of BASIC, are likely only similar and not identical.  And products can evolve over time, adding new capabilites and refining the manner in which they work.

In learning Object Orientation technology, it helps to focus on a given language, because the difference from one implementation to another can serve as a tripwire and make matters more confusing at a time when you are just trying to learn the fundamentals.

C++ and C## are two dialects of the C language with the ability to support OOP.  But it isn't necessary to limit your selection to either of these.  Many people prefer Visual Basic from Microsoft, which became part of their Visual Studio, and which has largely be superceded by Visual Studio for .NET.  I won't get into what that means, but it essentially focuses on development work for distributed enterprises that need to tie their computer applications and data together, wherever they are found.

Visual Basic verson 6 supports OOP, and is the language of choice for many.  Looking on the Internet, I can see places where it is still available.  But you have other options as well, such as RealBasic and kbasic, both also available from the Internet.  I'm taking a close look at kbasic, because it promises source code compatibility with VB6, it is a cross-platform compiler for Windows, Linux, and the MacOS (it relies on Qt for this capability), and because you can get all three packages from them for about $35 U.S.  And you can download the trial version or use the Open Source version of kbasic for no charge, just to see if it is what you want or not.

So with these options available, there really should be no reason why you can't make an effort to pick up on OOP and advance yourself via your programming skills.

Patrice Terrier

For me using OOP or the classic PROCEDURAL syntax, is more a question of reusability of my existing code.

While I am using some languages that are OOP only, like C#, some are not, and some accept both syntax like WinDev.

The procedural model using the CALL syntax is almost universel, while the OOP implementation is often specific to the language being used.

And when i write a plain Win32 DLL in procedural mode, i know i could use it with all the programming languages, it is like using plain SDK   ;)

Now, if PowerBASIC could introduce some OOP features in PB9, then I would be very glad too  ;D


Patrice Terrier
GDImage (advanced graphic addon)

Petr Schreiber

Now, if PowerBASIC could introduce some OOP features in PB9, then I would be very glad too ;D

I do not want to start any vaporware / unsubstantiated discussion here ... but did you noticed that when you type word "class" in PB8.04, it is highlighted as keyword? I asked PB support about it and got following reply:
Currently the reserved word "Class" is not implemented in the compiler, but is reserved for future use.

So ... maybe ? ;)

Regarding "modern programming concepts", I think OOP is not so new concept as I thought.
Do you know about some newer approach than OOP is?

AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

Patrice Terrier

>> Currently the reserved word "Class" is not implemented in the compiler, but is reserved for future use.

So ... maybe ?

If it is reserved for future use, then let's see for the future version ... who knows 8)

For me OOP is more a matter of new syntax than anything else, because alone it doesn't brings new features.
But when it is tied to COM, then it gives us direct access to IMAPI2 or DirectX (and all the latest Microsoft API) that are a pain to use with the current PowerBASIC syntax.

Patrice Terrier
GDImage (advanced graphic addon)

Donald Darden

Well, what is "newer" than OOP is ,NET, AJAX, and web-based applications.  Visual Studio for .Net goes farther than the previous Visual Studio did, but you guys probably knew this.

What you might have missed is that RealBasic and kbasic have emerged to move OOP programming in BASIC to the cross-platform arena.  I'm still reading the preliminary documentation on kbasic, but it admits that it is relying on Qt for its ability to do this, and though I haven't read up on Qt yet, it comes with its own GUI.

So, if you want to stick with Microsoft, then you have to give up cross-platform objectives, at least for the time being, because .NET and COM are not cross-platform in nature.  Nor is DirectX.

It's just my considered opinion, but PowerBasic is so closely tied to the Windows' environment, and yet still needs to really come to terms with OOP, COM, .NET, DirectX, the Vista APIs, and other concepts that are also tied to Windows, that it's future is almost certainly aimed at continuing down that road.  And it does not really have the resources to travel too many paths at the same time.

At the same time, from a BASIC programming perspective, it has at least three rivals that are cross-platform capable to a greater or lesser degree:  the two mentioned above, and FreeBasic. 

Now what would you do in their shoes?  In order for PowerBasic Compilers to be as capable under all three OSes (Window, Linux, and MacOS), they have to have a common interface and the same range of commands, functions, and syntax.  But the three systems are different under the hood, and to satisfy existing users of PowerBasic, the company would have to somehow contrive a means by which Linux and MacOS look and respond like Windows.  That's a tall order.  If it introduced a diminitive compiler for Linux (and possibly the MacOS), people have already said they would not buy it.  It would not be enough.

So why should PowerBasic risk it future trying to produce something that people may turn down, and invest heavily in development where the market share is still too small to properly evaluate?  Some people speak of needing Pb/Linux as though it were the way into the promised land of Windows to Linux transition.  I guess I was one of those people myself, once.  But getting into Linux is as simple as downloading and burning a LiveCD distro, and BASIC programming does not have to wait for PowerBasic to commit itself to the same end.

It is becoming increasingly rare for me to boot straight into Windows.  More often, I boot into Ubuntu, start up VirtualBox, and start Windows there.  Then I move freely back and forth between the two environments as I need to .  I have several BASICs, including PowerBasic, on my Windows virtual setup, and have kbasic on both Windows and Ubuntu.  It took me some time to get everything set up, but it is an extremely easy environment to work in.

Want to hear something wierd?  Yesterday I creaded a monthly calendar in Word on my virtual Windows, but I needed to resize it to print two to a sheet.  I could not do this in word, I needed to change it to a graphics first.  I found a shareware program to do this for $40, but decided I could probably do it another way,  I adjusted the image size displayed and picked full screen mode in word so that the whole calendar showed up, switched back to Ubuntu, set up the screen capture there for a three second display, went to full screen mode for the Virtual Windows, which now showed the calendar full sized,  waited a few seconds, minimized the virtual window, and saved the screen capture to a file.  Worked like a champ.  I then copied the image to my virtual Windows' desktop, started Picture It! which I had installed there, cropped the border around the calendar, rotated it, resized and positioned it, copied it to the other half of the sheet, and printed it on my printer.  Now I am ready to run off copies.

The thing is, I could have done this with just Windows, or just Ubuntu, but by using both, I could use the best tool available on either side to get the job done.  The only problem was that Picture It! could not read or write to the Ext3 partitons - it saw the contents as unacessable.  It apparently uses a different method for reading and writing to files, so I could not access the image directly from the Ububnu's Desktop.  But that was a minor issue.

I'm way off topic here, but I think it won't do much good to stay focused on what PB may or may not do with their product line.  We have options, some good ones, and it is time to consider them.

I found a link that offers a 10-week tutorial course on Visual Basic 5/6 on CD for $19.95.  They also offer the first four chapters as a free download.  That might help someone get started and get past some of the initial issues.

I also found a link for getting Visual Studio 2008 Express as a DVD .ISO image.  This might give someone an essential tool for getting started with Visual Basic or some other Microsoft Development Product:

There is actually a lot of postings related to Visual Basic and Visual Studio on the internet, and I won't try to explore those any further.  Anybody can get to these by searchinf for them.  What is interesting is that a lot of these resources involve a fee of some sort.  It's not common to find free stuff when it comes to Windows and other Microsoft products combined.  It's more likely to find similar information at no charge when discussing Linux and products that work it that environment.