Community Coding Standards, Naming Conventions, Best Practice in LiveCode Script for community contribution work

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Community Coding Standards, Naming Conventions, Best Practice in LiveCode Script for community contribution work

Mike Kerner via use-livecode
I am referring to the note from Richard and to our discussion about
Contribution From The Community - expanding the developer base to "hundreds
and thousands of users" -- even if only 10 will remain?.

Richard wrote:
> At the bottom of the "Contributing" page for the LC code base there are
> links to C++ style guides:
> https://github.com/livecode/livecode/blob/develop/CONTRIBUTING.md

These are just a few more links found with a quick search.

http://www.fourthworld.com/embassy/articles/scriptstyle.html#Naming
http://forums.livecode.com/viewtopic.php?f=7&t=22946
http://lessons.livecode.com/m/4603/l/284467-variables-in-livecode
http://forums.livecode.com/viewtopic.php?f=7&t=5265
http://stackoverflow.com/questions/16746794/what-are-some-best-practices-for-function-naming-in-livecode-runrev
http://use-livecode.runrev.narkive.com/ZPvn2z2N/object-naming-conventions
http://use-livecode.runrev.narkive.com/8REAd9JD/any-convention-on-naming-conventions

I kind of find it very important for joint work and contributions. Maybe
there should be a page from LiveCode offering at least a semi-official
Community Standards Guide (or whatever it would be called) for
LiveCode Script.

Or will we all switch to LCB and slowly forget about LCS? (I am not sure
here.)))

For local variables, I also do not like long expressions for simple
counters which are created "on the fly". The most widely adopted standard
is using i, j, k, l ... (not x and not tCount) -- but otherwise, local
variables in LCS start with "t" in LCS as tSomething. But something should
be recommended for all others to follow, and not just say "do as you like"
-- if there is any joint community effort expected.

Yes, I am using pSomething for parameters even though there could be
arguments against it. But I find them quickly in my script and know what
they mean.

And when I put something into the messages box, I ALWAYS type "put ... into
msg" instead of simply "put ..." because then I can find such instances
with the search and disable or enable such instructions. There are too many
"puts" to search for otherwise. Little things that make life easier.

But more important, an adopted COMMUNITY standard should be widely
available and prominently placed to allow new users and everyone to access
it at any time - maybe even as a separate section in the dictionary? I
suggest a section discussing the STANDARD way of naming, writing code,
naming functions, naming keywords, ways of commenting, what to avoid, what
to care for, warning from pit holes, how to publish to the community, how
to open new projects to the community, best way of debugging, best way of
implementing error detection in general, best way of avoiding the script
editor to open when users are using our app, single/multi user approaches
with a rights management, best way implementing a database management
system with remote databases depending on security issues and number of
concurrent users considerations, how to implement design concepts (such as
Googles material design), etc.

And it could also be argued that data-driven applications use a lot of
databases, and the naming conventions for such databases should be
maintained, for example not to use the "_" underscore as a first char for
field names, or not to use upperLower (camel case) naming when the database
distinguishes between upper and lower characters, because easily, simple
typing mistakes can create hours of searching the problem.

The best STANDARD here is to look for the LOWEST COMMON DENOMINATOR when
interfacing with other languages and systems. And we will interface sooner
or later.

The document should also talk about best practice in general, and for
specific cases. Let us not reinvent the wheel when others before us already
have found the optimal solution for a given problem. Yes, things can be
done in different ways, but then it would be up to the community to test
and do benchmarking and detect the better and decide for the best (rating
with stars?). There could be a competition to beat the benchmarks and a
gold medal for the best contribution.

What really means "quality" code here? Who can guide me, others, everyone?

Again, how can we (could I) contribute making this a reality? Who can
answer?)

Roland
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Community Coding Standards, Naming Conventions, Best Practice in LiveCode Script for community contribution work

Mike Kerner via use-livecode
The problem with ambiguous counter names is that often there are nested repeat loops and knowing which counter for which loop is crucial to understanding the code. I almost never use i, j, k, l and when I do, I usually regret the choice and remember why I don't use them.

Bob S


> On Apr 27, 2017, at 09:31 , Roland Huettmann via use-livecode <[hidden email]> wrote:
>
> For local variables, I also do not like long expressions for simple
> counters which are created "on the fly". The most widely adopted standard
> is using i, j, k, l ... (not x and not tCount) -- but otherwise, local
> variables in LCS start with "t" in LCS as tSomething. But something should
> be recommended for all others to follow, and not just say "do as you like"


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Community Coding Standards, Naming Conventions, Best Practice in LiveCode Script for community contribution work

Mike Kerner via use-livecode
In reply to this post by Mike Kerner via use-livecode
These are good questions, Roland, and indeed it would ideal if such
things were in hand right now.

But to create a comprehensive style guide for IDE contributions we'd
have another scope of work to address, in addition to other
opportunities at hand.

If someone wants to dive in and put something like this together that
would be great, but I don't believe the absence of it need stop anyone
from writing and sharing good code.

We've seen many contributions to both the engine and IDE code with only
the documentation we have today and a willingness to code.

If someone wants to contribute code to the IDE suggest it to the team,
talk over how it fits, read their code to see how to integrate it, and
in reading the code you'll see the style that will fit best.

Personally, before I would be motivated to document code style any more
than I already have, I'd need to see specific fixes and enhancements
that are prevented by that documentation's absence.

Where we can find such blockers, let's provide what's need to unblock them.

And where we can proceed with what we have, let's proceed.

--
  Richard Gaskin
  LiveCode Community Liaison


Roland Huettmann wrote:

> I am referring to the note from Richard and to our discussion about
> Contribution From The Community - expanding the developer base to "hundreds
> and thousands of users" -- even if only 10 will remain?.
>
> Richard wrote:
>> At the bottom of the "Contributing" page for the LC code base there are
>> links to C++ style guides:
>> https://github.com/livecode/livecode/blob/develop/CONTRIBUTING.md
>
> These are just a few more links found with a quick search.
>
> http://www.fourthworld.com/embassy/articles/scriptstyle.html#Naming
> http://forums.livecode.com/viewtopic.php?f=7&t=22946
> http://lessons.livecode.com/m/4603/l/284467-variables-in-livecode
> http://forums.livecode.com/viewtopic.php?f=7&t=5265
> http://stackoverflow.com/questions/16746794/what-are-some-best-practices-for-function-naming-in-livecode-runrev
> http://use-livecode.runrev.narkive.com/ZPvn2z2N/object-naming-conventions
> http://use-livecode.runrev.narkive.com/8REAd9JD/any-convention-on-naming-conventions
>
> I kind of find it very important for joint work and contributions. Maybe
> there should be a page from LiveCode offering at least a semi-official
> Community Standards Guide (or whatever it would be called) for
> LiveCode Script.
>
> Or will we all switch to LCB and slowly forget about LCS? (I am not sure
> here.)))
>
> For local variables, I also do not like long expressions for simple
> counters which are created "on the fly". The most widely adopted standard
> is using i, j, k, l ... (not x and not tCount) -- but otherwise, local
> variables in LCS start with "t" in LCS as tSomething. But something should
> be recommended for all others to follow, and not just say "do as you like"
> -- if there is any joint community effort expected.
>
> Yes, I am using pSomething for parameters even though there could be
> arguments against it. But I find them quickly in my script and know what
> they mean.
>
> And when I put something into the messages box, I ALWAYS type "put ... into
> msg" instead of simply "put ..." because then I can find such instances
> with the search and disable or enable such instructions. There are too many
> "puts" to search for otherwise. Little things that make life easier.
>
> But more important, an adopted COMMUNITY standard should be widely
> available and prominently placed to allow new users and everyone to access
> it at any time - maybe even as a separate section in the dictionary? I
> suggest a section discussing the STANDARD way of naming, writing code,
> naming functions, naming keywords, ways of commenting, what to avoid, what
> to care for, warning from pit holes, how to publish to the community, how
> to open new projects to the community, best way of debugging, best way of
> implementing error detection in general, best way of avoiding the script
> editor to open when users are using our app, single/multi user approaches
> with a rights management, best way implementing a database management
> system with remote databases depending on security issues and number of
> concurrent users considerations, how to implement design concepts (such as
> Googles material design), etc.
>
> And it could also be argued that data-driven applications use a lot of
> databases, and the naming conventions for such databases should be
> maintained, for example not to use the "_" underscore as a first char for
> field names, or not to use upperLower (camel case) naming when the database
> distinguishes between upper and lower characters, because easily, simple
> typing mistakes can create hours of searching the problem.
>
> The best STANDARD here is to look for the LOWEST COMMON DENOMINATOR when
> interfacing with other languages and systems. And we will interface sooner
> or later.
>
> The document should also talk about best practice in general, and for
> specific cases. Let us not reinvent the wheel when others before us already
> have found the optimal solution for a given problem. Yes, things can be
> done in different ways, but then it would be up to the community to test
> and do benchmarking and detect the better and decide for the best (rating
> with stars?). There could be a competition to beat the benchmarks and a
> gold medal for the best contribution.
>
> What really means "quality" code here? Who can guide me, others, everyone?
>
> Again, how can we (could I) contribute making this a reality? Who can
> answer?)
>
> Roland



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode