Classes

Jim Brown

Active Member
Licensed User
Longtime User
Hi Erel,
I would imagine this one would be a huge task to implement but what are your general thoughts on classes for Basic4Android?

Something like this for instance:
B4X:
Class TestClass
   Dim x,y As Int
   '
   Sub Clear()
      x=0 : y=0
   End Sub
   '
   Sub getTotal()
      Return x+y
   End Sub
   '
End Class

Dim blah As TestClass
blah.x=14 : blah.y=5
Log(blah.Total)
blah.Clear
Log(blah.Total)
 

Jim Brown

Active Member
Licensed User
Longtime User
I hear you. B4A is a *great* alternative to Java, by several hundred miles!
My experience with Java is that it wants to complain about everything, and then some!

As for classes, or OOP-style programming in general, I got to grips with this in another language. The logic of how OOP works clicked with me straight away. To me the main benefit of it was in tying everything together in one neat package, rather than having lots of separate procedural functions

I think a 'basic' implementation would be good to see in a future release
That is, no fancy "extends", "implements" stuff. Just enough functionality to retain the "pick up and code" feel of b4a
 

JakeBullet70

Well-Known Member
Licensed User
Longtime User
I hear you. B4A is a *great* alternative to Java, by several hundred miles!

I think a 'basic' implementation would be good to see in a future release
That is, no fancy "extends", "implements" stuff. Just enough functionality to retain the "pick up and code" feel of b4a

I have to say I would like basic class support too. :)

BTW, B4A is really a GREAT Android development platform. Looking forward to seeing what comes in the future.

Also, I love the help viewer!!!!!
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
I hear you. B4A is a *great* alternative to Java, by several hundred miles!

Agreed. It makes java look like a joke.

I add my vote for classes too, VB6 has classes. And it'd replace the need for custom controls. We could just pass an imageview to the class and it handle it
 

francoisg

Active Member
Licensed User
Longtime User
Propper classes, please ...

Agreed!
Seem that the developer is reluctant to add support for classes. The thing is (it seems) - most people using B4A comes from using C# or Delphi (or both as in my case), so we NEED classes, else we get confused ;-)
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
Agreed!
Seem that the developer is reluctant to add support for classes. The thing is (it seems) - most people using B4A comes from using C# or Delphi (or both as in my case), so we NEED classes, else we get confused ;-)

Id say more are coming from vb
 

kanaida

Active Member
Licensed User
Longtime User
Yes we are :) vb/vb.net people see this as an easy way to move to android, seeing java as an ugly beast we don't wish to learn when we can start making things right away.

Lately I've been wanting to create a game, but not having support for classes is the only thing holding me back. It's incredibly painful to try and make so many little game objects work properly and without inheritance, I have to remember all the objects I have to change or a bug could creep in.

I'd love to be able to just do something like this:

B4X:
Do While Running = true
ProcessInput()
For each GameObject in GameObjects
GameObject.Update()
Next
Render()
Loop

Its an organizational/maintainability thing, although code modules and structures can be used together, just merging the two and being able to declare them as one object simplifies lots of stuff and makes intellisense support better. I know that I can code around these things but I'd rather wait to start larger projects if it's possible to have support for classes. I know it's probably not easy to add such support, but I just wanted to give my view coming from an object oriented language to a semi-object oriented one.
 

kanaida

Active Member
Licensed User
Longtime User
I forgot to mention, I just tried eclipse and java, and by comparison I was able to compile and start Hello world! once before it messed up, the xml gui designer is buggy like crazy and not at all easy to understand, but b4a instantly feels like a lightweight visual studio a little bit more vb6ish but friendly none the less. It gave me the idea though (as far as classes go too), if there is some sort of reflection support like .net so you could allow us to write b4a code using native java objects in all the classes somehow. Just an idea, but it would allow us even more flexibility too.
 

Dextrosoft

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 ?
 

netchicken

Active Member
Licensed User
Longtime User
I am intending to teach students this later in the year. After having taught them classes in vb.net it feels like a step back to tell them they are not in B4A. In saying that its an awesome program, and we are all looking forward to getting into it. But classes would round the program out nicely, especially for us vb.net guys.
 

francoisg

Active Member
Licensed User
Longtime User
Like it too!!!
Adding proper classes will make B4A a 1'st class development tool for Android, no doubt!!!
 
Top