Verbosity and Lines of code

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Verbosity and Lines of code

Mark Waddingham via use-livecode
I Can't understand this fixation with how many characters typed.

I now quite like the verbose "dot notation" of Livecode - it's now second
nature and it's the last thing I would even bother asking to augment with
"real" dot notation.

the put <expression> into variable adds very little time to typing and is
so much easier to explain to someone who hasn't been tainted with decades
of the "right way" which was needed when teletypes printed at 10 characters
a second and they had time share systems which were charged on CPU time
used - more data/programs to parse more CPU usage.

If you actually time yourselves or just do a thought experiment - much
easier especially while eating a bar of chocolate, you will see that you
spend probably less than 10% - probably much less - of your time typing NEW
code.

When you start a project you are VERY productive - then you have to really
start thinking when you join the bits together, refactor this, delete that
etc etc.

Most of your time is taken up thinking finding bugs drinking coffee finding
bugs - going to the toilet finding parasites - sorry bugs.

If you add in the auto completion and snippets that some of you use in the
ATOM  editor its probably even less.

Just do the experiment - you WILL be surprised.

To save you the hassle these few links have some eye opening statistic
(from a Google employee and from study of a  Borland team)

The last 3 were stuff i've read before but the first one from Quora I just
found because I was looking for real actual metrics - and it does make the
case in my opinion.
The Bill Atkinson link is just to show the pitfalls of LOC as a metric  ,
which the first link shows as well when someone got his 1000 lines down to
2 lines!

https://www.quora.com/How-many-lines-of-code-do-professional-programmers-write-per-hour
https://blog.codinghorror.com/diseconomies-of-scale-and-lines-of-code/
http://www.folklore.org/StoryView.py?project=Macintosh&story=Negative_2000_Lines_Of_Code.txt
https://blog.codinghorror.com/in-defense-of-verbosity/


Kindest Regards Lagi
_______________________________________________
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
|  
Report Content as Inappropriate

Re: Verbosity and Lines of code

Mark Waddingham via use-livecode
which is exactly why regular expressions are such a PITA to diagnose.


On Fri, Jun 30, 2017 at 6:05 AM, Lagi Pittas via use-livecode <
[hidden email]> wrote:

> I Can't understand this fixation with how many characters typed.
>
> I now quite like the verbose "dot notation" of Livecode - it's now second
> nature and it's the last thing I would even bother asking to augment with
> "real" dot notation.
>
> the put <expression> into variable adds very little time to typing and is
> so much easier to explain to someone who hasn't been tainted with decades
> of the "right way" which was needed when teletypes printed at 10 characters
> a second and they had time share systems which were charged on CPU time
> used - more data/programs to parse more CPU usage.
>
> If you actually time yourselves or just do a thought experiment - much
> easier especially while eating a bar of chocolate, you will see that you
> spend probably less than 10% - probably much less - of your time typing NEW
> code.
>
> When you start a project you are VERY productive - then you have to really
> start thinking when you join the bits together, refactor this, delete that
> etc etc.
>
> Most of your time is taken up thinking finding bugs drinking coffee finding
> bugs - going to the toilet finding parasites - sorry bugs.
>
> If you add in the auto completion and snippets that some of you use in the
> ATOM  editor its probably even less.
>
> Just do the experiment - you WILL be surprised.
>
> To save you the hassle these few links have some eye opening statistic
> (from a Google employee and from study of a  Borland team)
>
> The last 3 were stuff i've read before but the first one from Quora I just
> found because I was looking for real actual metrics - and it does make the
> case in my opinion.
> The Bill Atkinson link is just to show the pitfalls of LOC as a metric  ,
> which the first link shows as well when someone got his 1000 lines down to
> 2 lines!
>
> https://www.quora.com/How-many-lines-of-code-do-professional-programmers-
> write-per-hour
> https://blog.codinghorror.com/diseconomies-of-scale-and-lines-of-code/
> http://www.folklore.org/StoryView.py?project=
> Macintosh&story=Negative_2000_Lines_Of_Code.txt
> https://blog.codinghorror.com/in-defense-of-verbosity/
>
>
> Kindest Regards Lagi
> _______________________________________________
> 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
>



--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
_______________________________________________
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
|  
Report Content as Inappropriate

Re: Verbosity and Lines of code

Mark Waddingham via use-livecode
In reply to this post by Mark Waddingham via use-livecode
What WILL save time (and I think it's on the list of future V9 features) is script editor "clairvoyance" or AutoFill as it's called. Imagine all your text variables starting with vtx (autofill usually requires a minimum of characters typed) and now you get a list of all your text variables, or array variables, or whatever variables. Suddenly you realize there is a mistyped entry. BUG FOUND! Imagine an editable list you can add to for things like 3rd party commands and functions. Typing dbquery_createObject() every time I want to use an sqlYoga query, THAT is too much typing!

Bob S


> On Jun 30, 2017, at 03:05 , Lagi Pittas via use-livecode <[hidden email]> wrote:
>
> I Can't understand this fixation with how many characters typed.
>
> I now quite like the verbose "dot notation" of Livecode - it's now second
> nature and it's the last thing I would even bother asking to augment with
> "real" dot notation.
>
> the put <expression> into variable adds very little time to typing and is
> so much easier to explain to someone who hasn't been tainted with decades
> of the "right way" which was needed when teletypes printed at 10 characters
> a second and they had time share systems which were charged on CPU time
> used - more data/programs to parse more CPU usage.


_______________________________________________
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
|  
Report Content as Inappropriate

Re: Verbosity and Lines of code

Mark Waddingham via use-livecode
In reply to this post by Mark Waddingham via use-livecode
Lagi Pittas wrote:

 > I Can't understand this fixation with how many characters typed.

This is part of a statement: It's
This is part of a statement: not
This is part of a statement: so
This is part of a statement: much
This is part of a statement: about
This is part of a statement: the
This is part of a statement: typing
This is part of a statement: as
This is part of a statement: it
This is part of a statement: is
This is part of a statement: about
This is part of a statement: clarity

There is content, and then there is syntactic sugar.  Whether that sugar
is sweet or merely noise may be subjective, but I believe it's useful
(and apparently entertaining for some of us here <g>) to at least
discuss it where it may pertain to new contexts.

The with-the-grain method for passing name-value pairs as a param in
LiveCode is to use an array, and arrays often need to be loaded with
blocks of code in which each line assigns one value to one key.

The example above is an English-like way to communicate with humans
using a similar pattern.  What we have is ultimately a single
expression, but when we load each meaningful part of the expression in a
separate statement filled with repetitive sugar the extra typing is less
cumbersome over time than the extra reading.

For small things it matters little.  And as I wrote before, the robust
performance of arrays makes them quite suitable for me in cases where I
need named args; the absence of a more concise method of expressing
those has never stopped me from shipping anything.

But it's not like the languages which have adopted name-value pairs are
all made by dummies. There's probably a reason so many languages support
them. Seems worthwhile at least exploring what those reasons might be.

Even if a language pattern isn't appropriate for LiveCode (and let me
please reiterate that AFAIK Mark Waddingham has already made it clear he
doesn't feel named params are worth pursuing in the engine for the
foreseeable future), such discussions may help inspire useful scripted
solutions, or perhaps lead to other things that may indeed be worth
pursuing in the engine.


One of the best LiveCode conference sessions I ever attended had nothing
to do with LiveCode - it was about everything else, about things NOT in
LiveCode.

At the RevLive conference in Vegas a few yeas back, Robert Cailliau's
opening keynote covered some of the most adventurous feature requests
I've ever heard anyone suggest for xTalks.

Here's one example (I'd love it if he could post his slide deck from
that talk; there were many great gems in it): named control structures.

This would allow us to exit a specific loop when loops are nested.

I can't recall the specifics of his proposed syntax, but I remember
being impressed by how natural it seemed. Maybe it was along the lines of:

   repeat with i = 1 to tSomething named "MySomethingLoop"
     repeat with j = 1 to tSomethingElse named "MyOtherLoop"
       DoSomethingWith i,j
       exit "MySomethingLoop"
     end repeat
   end repeat



While there's very little functional similarity between any programming
language and any natural language, the good examples of each have one
thing in common:  they continually evolve to meet changing needs.

The working vocabulary of 15th century England would be no more
satisfying for modern humans to express themselves than for today's
LiveCoders to limit their language to HyerTalk.

If we stayed true to the roots of the mother tongue, we wouldn't have:
- Arrays
- Binary file I/O
- Sockets
- Bitwise operators
- BinaryConvert
- BaseConvert
- StdIn/StdOut
- Encryption
- Hashing
- Scrollbars
- Anything related to mobile
...and a whole lot more.

Many of those would have been far too geeky for an authoring system
delivered in 1987.

But for a professional programming environment in 2017 they're essential.

Arrays are a particularly good example in this discussion because not
only were they completely absent from all versions of HyperCard,
SuperCard, and OMO, but their syntax is notably not at all English-like
(who talks in brackets?), following patterns already in common use
throughout much of the programming world.

In The xTalk Way, we might use:

    put "SomeVal" into bucket "SomeLabel" of array tArray

...rather than the more concise form we enjoy today:

    put "SomeVal" into tArray["SomeLabel"]

Again, the few extra characters doesn't matter much when typing as much
as it matters for reading.

Sometimes setting aside at least some of the syntactic sugar now and
then to let the distinguishing content become more readily self-evident
can be a good trade-off.

Not always, of course.

And that's why we have discussions like this one.

Not every feature of every language is worth implementing.  But most are
probably worth learning from.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
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
|  
Report Content as Inappropriate

Re: Verbosity and Lines of code

Mark Waddingham via use-livecode
The way it is in Director is nice. These are all valid statements:

put “one two three” into v
put the last char of word 3 of v
— “e”

v = “one two three"
put v.word[3].char[v.word[3].length]
— “e"

put [{a:1,b:2,c:3},{d:4,e:5,f:6}] into alist
put alist[2].d
— 4
put the d of alist[2]
— 4

put item 1 of the long date
 -- “Friday"

d = the systemdate
put d.day
 — 30

Whether or not there’s a verbose or dot syntax way to say the same thing, it’s nice to have a choice.



_______________________________________________
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
|  
Report Content as Inappropriate

Re: Verbosity and Lines of code

Mark Waddingham via use-livecode
In reply to this post by Mark Waddingham via use-livecode
On 30/06/2017 17:32, Bob Sneidar via use-livecode wrote:

> What WILL save time (and I think it's on the list of future V9 features) is script editor "clairvoyance" or AutoFill as it's called. Imagine all your text variables starting with vtx (autofill usually requires a minimum of characters typed) and now you get a list of all your text variables, or array variables, or whatever variables. Suddenly you realize there is a mistyped entry. BUG FOUND!
No. I found that potential bug weeks ago because I had the sense to run
with explicitVariables turned on :-)

>   Imagine an editable list you can add to for things like 3rd party commands and functions. Typing dbquery_createObject() every time I want to use an sqlYoga query, THAT is too much typing!
>
What I'd really like is an editable list of custom properties for an
object - and perhaps have autofill display them and let me choose.

Actually, I'd maybe be even more happy to have

     setPropdefault   -- called when setting any custom property which
doesn't have its own setProp
     getPropdefault   -- ditto

and then I could check if it was a typo (or other error).
e.g. I could do ....
     setPropDefault propName, newVal
       if propName is among the items of "contents,size,chart" then
           ....
       else
          if the environment is development then
             answer "mistyped again" & propName
          end if
      end if
     end setPropDefault

-- Alex.

_______________________________________________
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
|  
Report Content as Inappropriate

Re: Verbosity and Lines of code

Mark Waddingham via use-livecode
In reply to this post by Mark Waddingham via use-livecode

> RICHARDG  wrote:
>
> This would allow us to exit a specific loop when loops are nested.
>
> I can't recall the specifics of his proposed syntax, but I remember
> being impressed by how natural it seemed. Maybe it was along the lines of:
>
>   repeat with i = 1 to tSomething named "MySomethingLoop"
>     repeat with j = 1 to tSomethingElse named "MyOtherLoop"
>       DoSomethingWith i,j
>       exit "MySomethingLoop"
>     end repeat
>   end repeat


If we can tolerate 2 extra lines of code we can do nested exits this way:

   repeat with i = 1 to tSomething
      if exitMe = true then exit repeat
      repeat with j = 1 to tSomethingElse
         if exitMe = true then exit repeat
         DoSomethingWith i,j
         put true into exitMe
      end repeat
   end repeat

Jim Lambert

_______________________________________________
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
|  
Report Content as Inappropriate

Re: Verbosity and Lines of code

Mark Waddingham via use-livecode
That doesn't generalize to more than two levels (without many extra
lines of code) - you essentially have to number or label the repeat
loops, and check in many places whether the 'exitMe" variable has been
set to a higher level or not. And it's pretty fragile if additional
levels of repeat loop are added later.

and if the inner loop doesn't end immediately before the outer one, it
gets more messy - you need an exit check immediately after each "end
repeat" as well as at the top of the loop.

repeat with i = 1 to tSomething
   repeat with k = 1 to tElse
       if exitMe >= 2 then exit repeat
       repeat with j = 1 to tSomethingElse
          if exitMe = true then exit repeat
          DoSomethingWith i,j
          put 2 into exitMe
       end repeat
       if exitMe >= 2 then exit repeat
       someOtherCode "here"
     end repeat
    if exitMe >= 1 then exit repeat
  end repeat

(don't trust the above code - I have no idea whether "2" is the right
value to test for in those places :-)

-- Alex.

On 01/07/2017 00:59, Jim Lambert via use-livecode wrote:

>> RICHARDG  wrote:
>>
>> This would allow us to exit a specific loop when loops are nested.
>>
>> I can't recall the specifics of his proposed syntax, but I remember
>> being impressed by how natural it seemed. Maybe it was along the lines of:
>>
>>    repeat with i = 1 to tSomething named "MySomethingLoop"
>>      repeat with j = 1 to tSomethingElse named "MyOtherLoop"
>>        DoSomethingWith i,j
>>        exit "MySomethingLoop"
>>      end repeat
>>    end repeat
>
> If we can tolerate 2 extra lines of code we can do nested exits this way:
>
>     repeat with i = 1 to tSomething
>        if exitMe = true then exit repeat
>        repeat with j = 1 to tSomethingElse
>           if exitMe = true then exit repeat
>           DoSomethingWith i,j
>           put true into exitMe
>        end repeat
>     end repeat
>
> Jim Lambert
>
> _______________________________________________
> 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


_______________________________________________
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
Loading...