Lower case letter for all DroidScript's methods/functions

64 views
Skip to first unread message

Glenn Dwiyatcita

unread,
May 13, 2015, 9:32:10 PM5/13/15
to androi...@googlegroups.com
Hi guys,

any chance of following general JS convention for naming the methods/functions, i.e. lower casing the first letter of the name?

As Master Crockford says,

Most variables and functions should start with a lower case letter.

Aliasing the current names would be highly appreciated as well.


Mit freundlichen Grüßen,

Glenn

Dave Smart

unread,
May 14, 2015, 5:15:07 AM5/14/15
to androi...@googlegroups.com
Hi Glenn,

We deliberately chose the upper case convention so that users can easily distinguish between official JavaScript functions/methods and DroidScript functions and methods.  We also do the same for user functions in our examples Apps.

Also... the misalignment of braces is very unhelpful when teaching people to code as it can be very hard to determine the start and end of nested blocks.

Regards
David

Glenn Dwiyatcita

unread,
May 14, 2015, 8:40:19 PM5/14/15
to androi...@googlegroups.com
Hmm. Ok, Dave.

Maybe I'm gonna have to learn to live with that. Maybe. :) But, do you have any plan in the future for (at least) aliasing the names to give developers flexibility to choose the convention (opt-in/-out using the "lower-case" convention)? I personally think the current "upper-case" convention really hurts my JS eyes. I mean it's not like we're working with those .NET languages or anything. Even jQuery doesn't distinguish between their API methods and the native JavaScript methods - John Resig chose the lower case convention for all jQuery methods which is, by the way, a more common convention in JS community ;)

Need your opinion on this.</rantend> Thanks!

Cheers

Glenn

Dave Smart

unread,
May 15, 2015, 7:07:01 AM5/15/15
to androi...@googlegroups.com
Hi Glenn,

If you would like to create an 'optional' aliasing module that people can include, feel free to do that.  You could easily create one automatically by iterating through all of the app object methods and other various object methods.  I can send you the app.js file which contains all the objects if you like.

All samples and docs will continue to use the DroidScript convention though, but I'm sure your eyes will get used to it after a while.  My eyes have got used to many conventions and styles over the years as I have worked with Pascal, Assembler, VB6, C, C++, C#, Java and JavaScript in my professional career (>20 years).

One thing that you should bear in mind when using DroidScript is that it is primarily intended to be used as an entry point into learning general software development... and as such the chosen conventions are carefully designed to allow users to easily 'cross over' to the most popular languages used in industry such as C#, C++ as well as Java of course :)

Hope that makes sense.

Regards
David

Glenn Dwiyatcita

unread,
May 21, 2015, 8:15:58 PM5/21/15
to androi...@googlegroups.com
Well, in that case, that explains quite everything, and I guess it won't be necessary to send me the app.js file. :-)

Thank you so much for sparing your time to have a little discussion with me.

Keep up the good work.

Cheers,

Glenn
Reply all
Reply to author
Forward
0 new messages