lua-users home
lua-l archive

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

Hello folks. Is everything okay with you? I hope everything fine.

I want to obtain a Lua community help about serious Lua application programming.

 I watched Hisham´s lectures on programming Lua applications on Youtube (LuaConf 2017), which led me to try to get some help on this subject. I found very interesting his vision of how to program Lua in the form of libraries, but I still have a certain difficulty in translate this into my projects (and find LOA references in internet).

I have been developing some applications (with various sizes) in Lua at University of Campinas in the O&G area and I contacted (when I worked to a oil company) with the development of a big Lua application. I knew some members of the development group and as it was a large application, programmed 100% in Lua, generated a huge effort of code control, revisions, etc. But this was a long time ago, and today I miss some references that would guide in a proper way to develop large code in Lua, so that it had a more solid architecture.

As I did not graduate in Computer Science, but in Engineering, so I had to improved my knowledge through complementary readings. My beginning with Lua was greatly simplified, based on knowledge of structural programming for Basic and Fortran. But due curiosity and need in the new job at university, I started (re)programming in Lua with the Java-based object orientation paradigm, using a lot of Design Patterns (GoF and GRASP) concepts.

The gain in the quality of the code was immense, because I got “full documentation” of the code, low cohesion and high coupling in the classes (allowing to expand very quickly), greater clarity in the structure of the program, in short, many benefits (besides getting faster by to make time measurements via profiler and removing unnecessary things). 

But thinking Lua only in OO breaks down a little bit the essence of language, which in some moments "claims" for a light way of programming. As an example: I implemented an ArrayList (Java type) to encapsulate lists. It has become the most frequent object in large code, but staying instantiating always seems to me a waste of processing time (which thousands begin to count) within functions that call ArrayList locally. It seems like a not optimized code. On the other hand, the use of simple Lua table is too generic for a serious programming (Anemic Object would be the option?).

I keep thinking about the gain between defining what part of the code should be written in the structural paradigm and part of the code should be written OO. But how to live with both at the same time seems not so simple. Or even the functional paradigm ...

These are doubts of this type (and others - how to organize the modules efficiently - error management - always gives problem when I fall into an exception - etc).  Is there any book or reference that would help clarify these points? There are good books of Lua (I have the main ones), but the heavy work is not explained in the details.

I found something in internet pages, but it's still a long way to go. Unfortunately I do not have access to large codes of applications similar to mine, which would be a good way to grow in language and help spread here at university.

I really like the language (besides the appreciation for being native), but I have a lot of difficulty in extending its use in my group (basically Java and C# programmers). Generally I used it via the command line, without compiling the code - which gives me a greater dependence on own libraries ("my world", which has been cool to understand computer science).

So, I don't use LuaRocks... I feel apprehensive about having difficulties compiling, etc. I don't even use the interface with C (and derivatives), because the performance issue has not yet reached me (and because I find C too annoying).

Many times I do integrating with other tools (JS, GNUPlot, numerical simulators, ...), whichever is easier to generate quick results. More or less similar to the applications Hisham commented on in an application for power networks.

One point Hisham commented is the use of IDEs. I use LDT, but unfortunately it's running out of support, and a lot that could be added, like programming aid tools, etc. I downloaded ZeroBraine, but the LDT is more elegant (due Eclipse framework). And I also have versioning via git, by the help of my group staff.

Anyway, thank you for your attention. It's nice to talk to people who knows what you're talking about, in a world dominated by programmers for Java, C++ and Python... 

Sincerely yours,

João Carlos