|
Posted by Ben C on 10/07/07 10:34
On 2007-10-07, SpaceGirl <nothespacegirlspam@subhuman.net> wrote:
> Ben C wrote:
>> On 2007-10-06, SpaceGirl <nothespacegirlspam@subhuman.net> wrote:
>>> Ben C wrote:
[...]
>> For better or for worse.
>
> For better, as it really encourages reuse and superclasses (classes of
> classes etc).
In theory, yes. Where it goes wrong I think is when it is encourages
people to design arbitrary class hierarchies, which either get
overcomplicated, or require constant and painstaking "refactoring" when
the requirements change.
One might say well that's just bad OO programming, not OO programming in
general. But that's a cop-out-- the real question is how hard or easy is
it to do good or bad OO programming.
OO can encourage people to make too many design decisions up-front,
before they really know what they want to do yet.
It's supposed to protect against dreaded type mismatch errors-- you pass
the wrong type of object to a function by mistake-- but how often do
such errors actually really happen?
>> I like JavaScript more than either Java or C++.
>> Static typing and excessive object-orientation are over-rated-- they're
>> not the silver bullets they're sold as that automatically make programs
>> more robust and easier to maintain.
>
> Okay, keep in mind non-programmer writing this here:
>
> I agree but you can easily re-type (is it called casting?) an object if
> you need to, or use the generic object type of... Object :) It makes it
> SO much easier to trace errors, and keeps the overheads down (AS3 is
> much more efficient with correct typing, apparently, compared to AS2's
> fairly loose approach).
>
> OOPL does lead to somewhat easier to maintain code... as everything is
> inherited, you can create your own classes for special objects - for
> example extending a MovieClip object to add your own functionality. This
> is externalized in as class file. So, you can reuse that class in as
> many projects as you like, and if you improve that class or add new
> functionality, all the other projects inherit the new functionality too.
> also makes it much easier to break a project up into pieces if you are
> working in a team. Of course the downside of this... it takes a little
> longer to compile, and you have a lot more files to version control!
Those aren't really downsides. Both are worth it if it's easier to
maintain or break up between a team.
[...]
> The Event model has been seriously improved now. There are hundreds of
> events that you can capture using a really nice new syntax:
>
> objectName.addEventListener(EVENT_NAME, listenerHandler);
>
> function listenerHandler(evt:Event):void {
> // gets passed the event, now we can do anything we want with it
>
> }
>
> ...which for someone like me who is not a hardcore programmer is SO much
> easier to comprehend. There are now many, many EVENT_NAMEs that make sense.
I don't know what it was like before, but that looks OK. JavaScript DOM
events are just like that too. You get passed the event.
[...]
Navigation:
[Reply to this message]
|