[OpenLayers-Dev] constructor signatures

Zac Spitzer zac.spitzer at gmail.com
Fri Jun 18 06:05:26 EDT 2010


Every one is more than welcome to share their opinions and examples of their
experiences and frustrations with Ol.

I had the  exact same experience myself.

I'd like to see a debug build which validates argument collections, both for
required and unknown arguments. One which can be stripped out when building
a single file. Also with some generous debug messages, as with my email the
other day with the JSON issue.

Is it possible to generate full parameter examples via natural docs?

On 18 Jun 2010 18:49, "Richard Duivenvoorde" <rdmailings at duif.net> wrote:
>
> Don't have so much credit to interfere, but
>
> as a user I have seen users (mw) who made the mistake with eg the
> WMS-layer by putting param-arguments into the options-object and vice
versa
>
> what about always 2 object arguments:
> - the required
> - the optional (optional :-) )
> making it possible to check for the required (off course also possible
> with one object!)
> but for users googling for examples and copying code, it makes sense to
> know that the first object will always be the required ones (so in all
> googled code snippets the same).
> Seeing code with 8 parameters (even in one object), not knowing which
> ones are really required is not that easy.
>
> (though you can always read the api docs offcourse...)
> speaking of api-docs, it would be really nice to have the inherited
> required args, functions, props into a class definition also
>
> Regards,
>
> Richard Duivenvoorde
>
> On 06/18/2010 01:22 AM, Schuyler Erle wrote:
>>
>> On Jun 17, 2010, at 3:33 PM, Tim Schaub wrote:
>>
>>> In adding the WMTS layer, I created a constructor that takes a single
>>> argument. If others agree that this is the way forward, I think there
>>> is sense in getting used to it before 3.0.
>>>
>>> I am bringing this up here because Chris objected to my commit of the
>>> WMTS layer and reopened the ticket.
>>>
>>> If anybody else has an opinion about the many versus one argument
>>> constructor, please weigh in.
>>
>> I think that we can address this by placing a practical guideline on the
number of arguments to any function in OL. For example, we could express a
style guideline that any method that might take more than 3 arguments should
use a dict instead of OR in addition to one or two fixed arguments. We can
then require that any violation of this guideline be accompanied by a strong
justification in the code comments.
>>
>> SDE
>> _______________________________________________
>> Dev mailing list
>> Dev at openlayers.org
>> http://openlayers.org/mailman/listinfo/dev
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20100618/c67b19ae/attachment.html


More information about the Dev mailing list