tags:

views:

819

answers:

4

What is your opinion on BASIC programming languages?

BlitzBasic began on the Amiga (wikipedia). BlitzMax, designed on fasm and gcc (cross-platform, use C/C++ code in Max), is Object-Oriented (with inheritance and polymorphism), but still holds that same BASIC nature, which was ever so pleasant with the previous languages.

BlitzMax is designed on-top of Modules, where code can be pre-compiled and included in the final build.

Hello World example:

SuperStrict

Framework BRL.StandardIO

Print("Hello, World!")

Classes (Max Types):

[EDIT: I added an alternative example for creating TCars, the used example is just my style; this example could be done better, but I would be taking up a lot more space on the page]

SuperStrict

Framework BRL.StandardIO 
Import BRL.LinkedList

' This is by no means how it HAS to be done, you can use functions
' for creating an instance of a Type (an Object) or any other way
' you see fit to manage your Types

Type TCar 'A Type, or 'Class', for a car

    Global _list:TList = New(TList) ' This variable is accessable by anything within TCar

    Field vehicletype:String
    Field color:String, year:Int

     Method New() 'Called, automagically, when the object is created

      _list.AddLast(Self) ' Add the newly created object to the list

     End Method

     Method Create:TCar(_vehicletype:String, _color:String, _year:Int)

      SetVehicleType(_vehicletype)
      SetColor(_color)
      SetYear(_year)

      Return(Self)

     End Method

     ' Alternative to the Create method
     'Function Create:TCar(_vehicletype:String, _color:String, _year:Int)
     ' Local car:TCar = New(TCar)
     ' car.SetVehicleType(_vehicletype)
     ' car.SetColor(_color)
     ' car.SetYear(_year)
     ' Return(car)
     'End Function

     Method SetVehicleType(_vehicleType:String)
      vehicletype = _vehicletype
     End Method

     Method SetColor(_color:String)
      color = _color
     End Method

     Method SetYear(_year:Int)
      year = _year
     End Method

     Method Report()
      ' Automatic conversion from Integer to String
      Print(vehicletype + ", " + color + ", made in " + year)
     End Method

     Function IterateList()

      Local car:TCar

      For car = EachIn _list ' Iterate through all TCars in TCar._list and call the Report Method

       car.Report()

      Next

     End Function

End Type


Local mycar:TCar

' Create a few cars and call the Create Method
mycar = New(TCar).Create("SUV", "Blue", 1999)
mycar = New(TCar).Create("Truck", "Silver", 1997)

' Alternatives, using Create as a Function instead of a Method
'mycar = TCar.Create("SUV", "Blue", 1999)
'mycar = TCar.Create("Truck", "Silver", 1997)

TCar.IterateList()

Outputs:

SUV, Blue, made in 1999
Truck, Silver, made in 1997

BlitzMax's learning curve is very small, BlitzMax is very powerful because the amount of time, compared to languages like C/C++, it takes to produce some application/game.

Amongst the official modules, popular open source libraries like wxWidgets, libxml and Irrlicht have been wrapped for use in BlitzMax.

Thoughts? Would you use it?

EDIT: If you wouldn't use it, or have some sort of issue with BASIC languages, why?

+1  A: 

BlitzBasic is an example of a specialized High Level Languages. When I started in the 1980's there were numerous examples of these type of languages. I used one of them, Rocky Mountain Basic because in the 1980's it was good for I/O, Machine Control, and Graphical Display.

Over the decades the trend is has been to move away from specialized languages in favor of specialized APIs and libraries. As computers became more common and capable, the elements people used to create software increased in variety. Specialized languages started to lose ground to the traditional high level language paired with whatever set of libraries the programmer wanted to use.

With the quality and variety of frameworks, libraries, and APIs out today I would not use something like BlitzBASIC for any new projects. Instead find a high level language that you like (Ruby, Visual Basic, C#, Java, C++, etc) and a good set of libraries and framework to use.

RS Conley
Of course, no one would want to use BlitzBASIC in this world of modern computers, BlitzMax, however, is fairly high-level.I'm almost certain BlitzMax was intended for game creation, but it is very good at anything you throw at it (Applications, Toolsets, Game Engines, etc).
Plash
Sure, and may be the smart choice if your application happens to be limited in scope. This problem plagues vertical market developers more than game developers.
RS Conley
A: 

BASIC is one of those languages that's very much on the trailing edge of development, in terms of languages. For example, it seems like BlitzMax doesn't support the concept of a parameterized constructor, you are using a fluent method "Create" to initialize the values. Another suspicion is that it doesn't support any kind of lexical scope, your declarations explicitly specify "Field" or "Local" I point out these issues because they are design elements addressed 40 years ago in other languages.

Feature-wise, it seems decades behind VB.NET, but at least it compiles to native code, which is suitable for the small-game market it caters towards.

Caveat: I am not too familiar with any the BASIC-family languages, this is just my naive observation.

Jimmy
Parameterized constructor? Lexical scope? I'm no programming-terms expert, but I'm sure if I were to give more examples (with different styles), both would be dismissed.
Plash
A: 

Going along with RS Conley's response if you are looking for a language with that will create a good representation of your project without having to learn a lot of libraries or languages that are unfamiliar to you then Blitz would be the way to go.

The problem that you will run into is that many of these libraries that have been wrapped for BlitzBasic were not coded with the intent of being wrapped for the language. It is important to realize that there will quite possibly be differences in the way the output of a library is handle between the original version and the wrapper version. Also you may run into the problem of wrappers using outdated versions of the libraries.

In my opinion these highly specialized languages are good for beginners who are looking to get into the world of programming (I used BlitzBasic for some game development when I first started programming) and they are also good for prototyping ideas that you will eventually want to bring to a different language.

Bill
I 100% agree with you on the prototyping point.
Plash
+1  A: 

I've used BlitzMax extensively. It is a remarkably well designed language for basically being the work of one person. The best thing about it is that it will compile native applications for PC, Mac, and Linux. The wost thing is that the "IDE" is a complete joke. There is community edition that fixes some of the glaring issues but if you are used to xcode or Visual studio it will drive you nuts. The other thing that kills it for me is that you can not cast pointers to objects even if you know their address which I like to do a lot with Lua.

edit: another win with blitz is that you can compile C, C++, and obj-C in it using extern statements. This is nice because if you are using it for a quick and dirty prototype, you can slowly migrate code over to C (although the conversion can be a pain sometimes).

Nick
Ah yes.. the IDE :/ I use BLIde on windows, which is the closest comparison to Visual Studio, and have tried to get it working on Linux using WINE. Not in usable state, but an old trimmed version of the IDE (compiled using GTK) is quite usable for me.
Plash
casting pointers is hardly a language feature you'd want in Basic.
gbjbaanb
I think you can use HandleToObject and HandleFromObject.. But it might be something specific to Max. There is a Lua module which has support for objects, so maybe Max does support casting?
Plash