|
From: Barre B. <ba...@ho...> - 2000-11-30 10:20:10
|
Well thanks for the tutorial man... but you obviously
didn't read my previous posts...
Object orientation exists for a purpose, and no, Javascript
isn't "true" OOP, but close enough to be able to use the
most fundamental principles of OOP, for self explanatory
reasons.
I guess it comes down to a matter of taste and preference.
I thought creating a constructor method was a clean and
easy way of doing "extended" functions initialization.
But sure, assigning DynLayer as a method and then calling
it works too... :)
/ Bart
> On Wed, 29 Nov 2000, Barre Bizon wrote:
>
>
> I thinks you have learned too much of OOP languages
like
> Java C++ etc.
> JavaScript is not OOP - it is Object Language - not
> just merely OO :)
>
> I would recomend to look deeper into JavaScript.
> If i'm not mistaken - DunAPI never uses such thing
as "with"
>
> Also ... If only Netscape4 would be standart....
and JavaScrip1.3
> with it:
> ----------------------
> You can use call to chain constructors for an object,
> similar to Java. In the following example, the constructor
> for the product object is defined with two parameters,
> name and value. Another object, prod_dept, initializes its
> unique variable (dept) and calls the constructor for
> product in its constructor to initialize the other
variables.
>
> function product(name, value){
> this.name = name;
> if(value > 1000)
> this.value = 999;
> else
> this.value = value;
> }
>
> function prod_dept(name, value, dept){
> this.dept = dept;
> product.call(this, name, value);
> }
>
> prod_dept.prototype = new product();
>
> // since 5 is less than 100 value is set
> cheese = new prod_dept("feta", 5, "food");
>
> // since 5000 is above 1000, value will be 999
> car = new prod_dept("honda", 5000, "auto");
>
> --------- from JS1.3 documentation.
>
>
> Also I like "watch" method alot. but it is Netscape
only :-/
> It allows you to get rid of methods..
> Just mylayer.x=12 would move the layer.
>
>
> And... why you need to create object , based
> on something but not to extend the one you have?!
>
> ps. In the past you have had ability to make errors...
> Now ! with C++ - you could inherit them! :)
>
> Malx
>
> > Hmm.. but how about wanting widgets to fully extend
> > Dynlayer.. i.e. supporting exactly the same
initialization
> > as Dynlayer has without writing the code over again.
> >
> > Do you not think that a construct() method would be a
good
> > idea? As per my previous posts...
> > It wouldn't alter anything in essence.. nor complicate
> > anything. Just how the Dynlayer is initialized,
allowing
> > widgets to (easily) do a general DynLayer
initialization.
> > Apart from widget specific initialization...
> >
> > / Bart
> >
> > > I absolutely agree. Things are already complicated
> > enought and I don't want to add one single line of code
> > there.
> > >
> > >
> > > Dan Steinman wrote:
> > >
> > > > It is both mine and Pascal's opinion that no
special
> > inheritance system is needed for DynAPI. Just make
careful
> > attention, and structure using basic prototypes and you
can
> > do everything (except doing multiple inheritance).
Don't
> > overwrite variables, and you don't even necessarily
need to
> > overwrite methods, and everything works perfectly. The
> > most simplistic solution is often the best, and I
believe
> > that is the case here.
> > > >
> > > > Dan
> > > >
> > >
> > > _______________________________________________
> > > Dynapi-Dev mailing list
> > > Dyn...@li...
> > > http://lists.sourceforge.net/mailman/listinfo/dynapi-
dev
> >
> >
> > _______________________________________________
> > Dynapi-Dev mailing list
> > Dyn...@li...
> > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev
> >
>
>
>
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
> / Word is not a color, but a
picture. \
> _ _ / To understand it you must draw it by
yourself. ___ \ _ _
> \ ------- __ -- |^ ma...@ca...-
kpi.kiev.ua /
> \ --- --- | http://cad.ntu-
kpi.kiev.ua/~malvin/
>
> _______________________________________________
> Dynapi-Dev mailing list
> Dyn...@li...
> http://lists.sourceforge.net/mailman/listinfo/dynapi-dev
|