[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Writing and maintaining a medium-sized code base
- From: "Pierre Chapuis" <catwell@...>
- Date: Mon, 29 Aug 2016 09:20:41 +0000
My solution to that is typically:
- Use luacheck . Not passing luacheck should be the same as failing
the test suite. You can write a custom .luacheckrc with exceptions
for your project, but never use globals in modules.
- Do write unit tests. If you are wondering about which test harness to
use, use Busted . C.I. is not mandatory if you support a single
platform but it is very useful if you support several (especially if you
support several Lua language versions).
- There is no easy solution to the "I depend on the framework evvironment"
issue. My personal solution is the I and D in SOLID , i.e.: use many
small interfaces and make your business logic depend on them, not the
other way around. If you have not seen it you may want to watch
"Architecture, the lost years" which is a talk about Ruby on Rails
but explains this principle well . You may also look at Go code bases,
because Go encourages this style. This doesn't prevent you from mocking,
but at least it lets you do it easily.
- Even though I like some Object-Oriented principles, I am not an
advocate for Object-Oriented code. Basically I create instances
for objects that need state and I use simple functions in modules
for things that don't; I never use inheritance. But I guess this is
more of a personal choice than anything.
- At my current company we use ldoc  for documentation. Sometimes I
prefer just plain human-edited Markdown files. In any case make sure
to keep documentation up to date.