Classes

timwil

Active Member
Licensed User
Longtime User
Hi,

Funny that we still need to discuss in 2012 whether or not the addition of classes would be required...

I can't think of any valid reason why B4A would be better of without classes.
The VB6 approach ( classes supported, but not mandatory) would be a sensible approach. It would keep programming for absolute beginners on B4A very simple ( no classes) but still offer the possibility for more complex solutions.

In my opinion..Although I love B4A and admire what has been done until now, B4A will only just remain a toy without class support.

No way that any serious developing company would adopt B4A as a development tool for complex programs without classes.

Personally for me the Android devlopment with Java was a little bit hard to grasp, so I started with B4A..learned the basics of Android programming and than switched back to Java..and yes..now it started to make more sense.

I will always be B4A very greatfull for that. Best money ever spent to learn Android devlopment..

So B4A is a very good learning tool, in best case a tool for rapid prototyping but nothing more than that.

Question is : where does Erel see B4A in, let's say, 2 or 3 years ?

I disagree. I have written a couple very complex systems already utilizing GPS, HTTP, Bluetooth, Sockets....and so on. It is just a matter of preference - sure classes might make some things easier but do not dismiss b4a as a toy - this is real serious stuff!
 

COBRASoft

Active Member
Licensed User
Longtime User
I'm developing an industry app using B4A. Yes, it is doable, but not an easy task. Lucky I'm developing longer before classes were introduced in 'Basic', so I'm thinking like 15~20 years ago :). Classes would give my source code more structure and easier to maintain. Speed wise... It wouldn't change a bit.
 

timwil

Active Member
Licensed User
Longtime User
I'm developing an industry app using B4A. Yes, it is doable, but not an easy task. Lucky I'm developing longer before classes were introduced in 'Basic', so I'm thinking like 15~20 years ago :). Classes would give my source code more structure and easier to maintain. Speed wise... It wouldn't change a bit.


I know what you mean....I started out before 1984 when the original IBM PC (with a single 360K Floppy, 256K of RAM and monochrome non-graphics card) finally came to the Bahamas :)
 

COBRASoft

Active Member
Licensed User
Longtime User
Hehe, I'm talking about the good ol' C64, C128 and afterwards, a badass Amiga1200 (BlitzBasic and AmosBasic). On PC you had QBasic and GWBasic around that time (also used). It's a bit strange to reuse techniques learned back then for my phone :D.
 

timwil

Active Member
Licensed User
Longtime User
Hehe, I'm talking about the good ol' C64, C128 and afterwards, a badass Amiga1200 (BlitzBasic and AmosBasic). On PC you had QBasic and GWBasic around that time (also used). It's a bit strange to reuse techniques learned back then for my phone :D.


Strange but curiously nice!
 

timo

Active Member
Licensed User
Longtime User
(omitted)....So B4A is a very good learning tool, in best case a tool for rapid prototyping but nothing more than that.
...

That's exactly what i'm reading about b4a in other forums.
Personally I think b4a is enough powerfull to do pratically everything, anyway it can do a lot more then a middle-level programmer can afford. Adding Classes would be appreciated too, and it could also be a right marketing strategy.
 

Jim

Member
Licensed User
Longtime User
Adding classes would probably be one of the biggest improvements in B4A history.
 

Osi

Member
Licensed User
Longtime User
Must say that I don't agree with you. There are many small and medium sized companies who use Basic4android to develop complex solutions.

With that said it is highly possible that classes will be supported in the future.

This is music to my ears, seriously! But then again, I come from a Java / C# background :)
 

Jim Brown

Active Member
Licensed User
Longtime User
With that said it is highly possible that classes will be supported in the future
Big thanks (from the thread starter). I look forward to class implementation
 

netchicken

Active Member
Licensed User
Longtime User
Me too, it would have been great to see it in this version. It will really round out the language.
 

naruto

Member
Licensed User
Longtime User
Count me in for class support. It would give b4a a boost for sure as it would attract more developers.
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Binary tree example (sorting algorithm based on a tree structure):
Activity:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Dim root As TreeNode
   root.Initialize
   For i = 1 To 1000
      root.AddValue(Rnd(0, 1000000))
   Next
   root.PrintNode
End Sub

TreeNode class:
B4X:
'Class module
Sub Class_Globals
   Dim value As Int
   Dim left As TreeNode
   Dim right As TreeNode
End Sub

Sub Initialize
   value = -1
End Sub

Sub AddValue(v As Int)
   Dim n As TreeNode
   If value = -1 Then
      value = v
      Return
   Else If v < value Then
      n = left
   Else
      n = right
   End If
   If n.IsInitialized = False Then n.Initialize
   n.AddValue(v)
End Sub

Sub PrintNode
   If left.IsInitialized Then left.PrintNode
   Log(value)
   If right.IsInitialized Then right.PrintNode
End Sub
 

naruto

Member
Licensed User
Longtime User
Hi Erel,

Thanks for the great example.

B4X:
'Class module
Sub Class_Globals
    Dim value As Int
    Dim left As TreeNode
    Dim right As TreeNode
End Sub

Is is possible to create multiple instances of this class when I need them?
 
Top