Page 1 of 1
Class Library Differences - 30log vs Middleclass
Posted: Fri Feb 21, 2014 11:07 pm
by 3CordGuy
Hey Guys
I was searching the forums for an answer to this one today but couldn't find much on the topic.
I've selected 30log when I first started my initial "test project" with which to learn LÖVE and dive deeper into Lua. I really like it so far, but I'll admit I'm just now starting to dive into OOP.
When reading the forums, I've noticed a lot of users tend to suggest Middleclass as their goto class library. I can't help but be curious if I'm missing out on some functionality that makes it more prominent here on the forums???
What's the big difference or draw?
When I was looking at the docs on github for Middleclass, I didn't really see how you declare specific class variables before the object instance is initialized... If that makes sense.
Thanks for any illumination!
Re: Class Library Differences - 30log vs Middleclass
Posted: Sun Feb 23, 2014 12:45 am
by Inny
middleclass is the general recommendation as it has about the right level of functionality that most people need from a class-inheritance system. Mixins in particular are one of the stronger features.
30log also has a lot of good functionality, and there's no reason to bash on it.
Re: Class Library Differences - 30log vs Middleclass
Posted: Sun Feb 23, 2014 6:31 am
by Karai17
30log is actually kind of crap in that Inheritance is broken. I highly recommend either using middleclass or hump.class.
Re: Class Library Differences - 30log vs Middleclass
Posted: Sun Feb 23, 2014 7:52 am
by Roland_Yonaba
Karai17 wrote:30log is actually kind of crap in that Inheritance is broken.
Enlighten me, please.
I'd love examples.
Re: Class Library Differences - 30log vs Middleclass
Posted: Sun Feb 23, 2014 9:09 am
by Robin
Karai17 wrote:30log is actually kind of crap in that Inheritance is broken.
You might be thinking of the similarly named 3
2log, which I've skewered like something that gets skewered a lot,
three and a half years ago.
Not that 30log is free of faults. It uses a deep_copy implementation that is in some ways a deep copy implementation, some of the time. It handles non-tree datastructures much the same way SLib does. Keys are never copied. If you pass in a third argument, it becomes a shallow copy that only brings in values of a specific type, used to make sure mixins only mix in functions. Yep, deep_copy is one crazy function.
I didn't really want to take a close look, you can probably find much more wrong with it if you were willing to look at the code for more than five minutes
Re: Class Library Differences - 30log vs Middleclass
Posted: Tue Feb 25, 2014 9:41 pm
by 3CordGuy
I didn't really want to start a war here, I just wanted to know why people preferred one over the other... but if it gets super technical, then it may be over my head anyway.
Re: Class Library Differences - 30log vs Middleclass
Posted: Tue Feb 25, 2014 9:48 pm
by Karai17
Nah, there is no war here. the 30/32log libs annoy me because their main goal is to use the least amount of lines to prove a point, instead of provide the most amount of function to provide a service. Middleclass and hump.class are both top notch libraries (hump also has lots of other terrific libs) and I recommend using either.
Re: Class Library Differences - 30log vs Middleclass
Posted: Tue Feb 25, 2014 10:02 pm
by szensk
I like Moonscript's class implementation.
Re: Class Library Differences - 30log vs Middleclass
Posted: Tue Feb 25, 2014 10:08 pm
by Roland_Yonaba
szensk wrote: I like Moonscript's class implementation.
Which is described
here, by the way.
Re: Class Library Differences - 30log vs Middleclass
Posted: Sat Mar 01, 2014 4:15 pm
by 3CordGuy
Roland_Yonaba wrote:szensk wrote: I like Moonscript's class implementation.
Which is described
here, by the way.
Thanks for the link. That looks a bit too complex for my skill level. I'm still wrapping my brain around the basics.