Learning to read code

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
TomKeane123
Posts: 7
Joined: Sat Jul 06, 2019 10:04 am

Learning to read code

Post by TomKeane123 » Sat Sep 28, 2019 12:17 pm

There has been lots of research to find the most common words in the English language that uses Frequency analysis.

I was wondering if it would be possible to write a program that could do Frequency analysis on computer code so that people could start learning to code by using the most commonly used handlers, keywords, variables, etc

If a program could be created for reading Livecode stacks and open source code on git hub could be analysed for Frequency analysis and then a general service list could be written for live code stacks.

This could even be used for creating flashcards with the code on the front and the dictionary explanation on the back so that memorising the Livecode dictionary could be even easier.

The wikipeadia shows an example of what I mean.

wikipedia Most_common_words_in_English

wikipedia General_Service_List

Xero
Posts: 152
Joined: Sat Jun 23, 2018 2:22 pm

Re: Learning to read code

Post by Xero » Sat Sep 28, 2019 12:47 pm

That's a tough one...
Code is contextualised, so it depends on what app you are writing, not necessarily just code...
For example, if I am writing a database app, different code will be used than if I were writing an image manipulation app. Some overlap will happen with "on mouseDown" commands, but if you know English, you know what they do... it's pretty straightforwards.
The rest is often conceptual, not linguistic. For example, everyone uses containers to track data, but you never say "create a container", you just do it. For example, "put the name of me into tName" creates a container called tName, but you never say 'create the container'. And what name you use is a coder-to-coder preference.
Consequently, coding is often learned contextually as you create an app that does something. learning what everything does along the way.
However, I find this methodology slow and often good only for the thing at hand, so when I want to do something new (which I always do), I have to hunt through a load of stuff, hack up other people's code, get frustrated and ask an expert.
I think it would be a better way forwards to learn common concepts, and code that achieves those concepts, but explain the code line-by-line so that the words make sense in context.
Don't forget that "line" comes up in two different contexts (line of code and line drawing), and frequency analysis would bias towards such multi-contextualised words...
Good luck with it.
XdM

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Learning to read code

Post by bogs » Sat Sep 28, 2019 1:34 pm

Xero wrote:
Sat Sep 28, 2019 12:47 pm
That's a tough one...
I think that is an understatement heh.

I also tend to think that is why most IDE autocomplete functions work the way they do, something like this
vsNetAutocomplete.png
VS.net 2003 ...
vsNetAutocomplete.png (5.56 KiB) Viewed 2336 times
In the MS VS IDE for sure they include the brief explanation. I can't remember if the Java (Oracle) IDE did or not.

I think something like that would be far more helpful as your learning to program, as it tells you right away if your looking at a function, command, property etc. *and* gives you a brief refresher on what your thinking about using does.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9669
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Learning to read code

Post by dunbarx » Mon Sep 30, 2019 1:27 am

Hi.

Intersting question. But as others have said, code does not lend itself easily to straight lexicographic analysis.

Far more effective is being mentored through simple tasks, such as found in the many lessons available. I have taught newbies how to use LC, and always done so by guiding them through the construction of very simple apps. After getting used to stack structure and message stuff, they only needed perhaps two dozen native words to build a working stack. Afterwards, they were able to work much more independently.

I always say that any small, even embarrassingly trivial-seeming stack will NOT involve trivial programming. Most of the real learning anyway is to be found in perfecting and augmenting the core construct. That process never ends.

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”