lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Apr 26, 2017 at 7:07 PM, Sean Conner <sean@conman.org> wrote:
> It was thus said that the Great Coda Highland once stated:
>> Lua is a good lightweight general-purpose language, don't get me
>> wrong, and there's probably nothing wrong with exposing fledgling
>> programmers to it. But in terms of actually building engineering
>> skill, I think starting off with a statically-typed object-oriented
>> language is a better choice.
>
>   Remove "object oriented" and I would probably agree.
>
>   -spc (At the very least, come up with some better examples of OOP than
>         animals, vehicles or shapes)

I think I'm weird or something or I'm not seeing your particular
forest for the trees that I've stared at. I think I'd pox both of your
houses.

Static types: When learning how to program, I don't know that static
typing is a net positive. To me, it tends to push problems elsewhere
and cause a whole lot of code to be generated, just to get around the
strong typing. When you're first starting out, is it necessary to
teach this or is it a concept that can be added later?

Early on, I want to learn about the basic structures of programming
and how they're composed. I want to learn about:

 - Values
 - References
 - Variables
 - Scope (and thus globals and locals and upvalues)
 - Functions
 - Branch statements
 - Loops
 - Structures
 - Using libraries
 - Breaking things into components / files
 - Testing
 - How to organize projects, comments, etc.

When I was first learning to program, the #1 word that I wanted to
avoid was "except", as in, "...works like this except sometimes, which
we'll cover 7 chapters from now, but try not to think about that right
now..." That sort of phrasing kills confidence.

To me, with the right curriculum, Lua is excellent for teaching
someone how to program. Simple is beautiful and the fact that you have
to create most of the more advanced structures and concepts is a win.

 - start by teaching structured programming
 - demonstrate C-style objects (functions with a state structure)
 - ease into object oriented programming using tables with properties
and methods and the ":" operator.
 - Maybe show some craziness with metatables and operator overloading
 - Then make them do another object model, using closures.

Make me construct my own object model in two different ways and I can
assure you that I'll understand the concept better than if you just
hand it to me.

Same thing is true with arrays: in Lua, I have to implement them with
tables. If I want to make sure that I don't have holes, then I have to
learn how to do that too.

There may be data that proves me wrong, but when I'm learning, I want
to have a feeling for what is going on and a sense that I can hold
everything in my head.

-- 
Andrew Starks
612 840 2939
andrew@starksfam.org