Try writing static facades for a class with any larger interface than five or so methods and it becomes tedious to say the least. not to mention that every time you add a function to the Manager class you have to manually expose it through ManagerImpl. If there was a codegen tool that could do this for me, I'd not care so much but with languages as they are at the moment, this kind of extensive delegation involves too much grunt work.
 
Languages should have a "wraps" keyword to manage this. In the AS2 days you could use __resolve quite nicely to delegate behaviour but lost typesafety :(
 
I don't think Roger's solution would hold much traction with my team leader who is always looking for the "path of least resistance" (sorry Roger!). Unfortunately, it looks like AS3 doesn't have one of those when it comes to implementing singletons (or template methods for that matter).
 
Otherwise, i think AS3 is awesome and congratulate all the Macrobat dudes for revamping their platform Yet Again! Well done :-) And the performance enhancements combined with Flash's capabilities mean that people will use the language no matter what. Heck, if it still had AS1 syntax, we'd still be using it.
 
But really, I think abstract classes and modifiable constructors should make it into the AS4 spec. And typesafe delegation/wrappers that also avoid pointless delegation code like in Roger's example!
 
My $.02.
 
Cheers,
Jules

 
On 2/13/06, Michael Hansen <[EMAIL PROTECTED]> wrote:
Please explain why Roger Gonzalez (last 4 lines) construct is a hack (other than different from the Java way)?

It is interesting to note that private constructors are discouraged in C# 2.0 and replaced by statics. (much like in AS3)

cheers

 -michael



On 2/12/06, Xavi Beumala < [EMAIL PROTECTED] > wrote:
Hi there,
I also completely agree with you. If it's a fact of architecture why not let us (programmers) decide what to use (internal vs private) ??

All new features on AS3 and FES are really amazing, but I think two main things are being forgotten as has been said: abstract classes and private methods.

It's really tricky and weird to use runtime exceptions to control what can be controlled at compile time.

And despite patterns are language agnostic and can have different implementations on different languages they must be easy to identify on the code. Using hacks like the ones explained isn't easy to identify them. Implementing a template method using exceptions IMHO also looks really bad...

Just my opinion
X.



On 2/12/06, Carlos Rovira <[EMAIL PROTECTED] > wrote:
Thanks to god! I thought was completly alone in this topic! : )

2006/2/12, Jens Halm < [EMAIL PROTECTED]>:

> again from other people's coming to the Flash platform  they look at
> all this stuff as the typical flash hacks from old days.

> I don't know why are you so reactive to introduce private
> constructors that are very clear and precise to resolve this kind of
> things and don't need any trick.

> Another question is what's about Abstract classes that are again very

 

needed.

> Please rethink this two things so we could get a very flexible
> languaje and bring more people form other backgrounds to our beloved
> platform without think that we have a platform full of hacks.

I have to second all those points.

Ok, now we know Adobe had long discussions internally about this
issue, but I still can't see any disadvantages in permitting
non-public constructors which might have led to this decision.
As it seems evident from this and other similar threads the
proposed workarounds for singletons are ugly and confusing for
most developers.

As for abstract classes: Maybe they are not part of ECMA 4 yet?
I tried to google it up, but somehow I am not able to find an
up-to-date specification draft. (The newest one I was able to find is
from 2003). In AS 3 abstract is a reserved keyword but it's not used
yet. But again: If we don't get abstract classes we need non-public
constructors to fake them. In AS 2 I combine private constructors with
empty (pseudo-abstract) template methods to accomplish this.

AS 3 is a huge step forward, but I still miss some pieces in the core
language:

- Private constructors

- Abstract classes and methods

- Enumerations!

- Class.instantiate(args:Array) method


Jens
www.oregano-server.org




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS






--
::| Carlos Rovira
::| http://www.carlosrovira.com

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS






--
Xavi Beumala
http://www.code4net.com


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to