The LostMVC - Codru project is officialy abandoned - Reasons and what I've learned

/images/projects/foggy-forest-codru-lostmvc-framework.jpg
foggy forest codru lostmvc framework

If you don’t know what LostMVC was please read What was LostMVC - Web Framework

I’ve decided to officialy abandon the LostMVC project I have been working in the past 2 to aprox 3 years. (From 2013 to 2016) (Github: https://github.com/Enotsoul/codru-web-framework)

Let me first tell you that this has been a formidable learning experience. I’ve spent 1 to 3 days per week working on it.
Reviewing my time tracking software with both Project Hamster and my own Timetracking software built with this framework estimated around 1500 hours spent on this project and all subprojects. Including virtual machine management, installation, management, updates, debugging etc.
For some time I was sad that I spent so much time working on such a big project and I wanted to abandon it earlier. But since i’ve created multiple subprojects based on it it had been a hard choice.
So I felt that I wasted time on it instead of working on other projects. I was highly discouraged.
But I’ve learned some valuable lessons which I only had read about in the past. Knowledge is the key but practice is the palace.
I’ve been inspired to think that all great inventors and geniuses had such experiences.
If you read the life of Leonardo da Vinci you will stumble upon many "failed" experiments.

Maintaining such a huge process alone is cumbersome and error prone.
Everytime a new third party library comes out you have 2 options.
Use the old one and miss out improvements or security fixes but have working code
Use the new one and spend a lot of time fixing issues, writing new testcases, modifying the whole system again.
Updating sub systems.. Freaking out because an existing project crashed even though you had TESTS and a full PDLC.

If you decide to use a language because it’s cool and does the job better than other language be prepared to have a hard time.
First, your language of choice might not land you a job since you need exprience with a proper language.
Second, there are usually not enough tools out there.
In my case I had to look at other languages C, PHP, python, ruby and then implement everything in Tcl if no library was available.
There is NO community.
There is NO one who has experience in what you’re trying to do. So you’re left alone to figure it out.
Doing the work of DevOps, sysadmins, programmers , testers all in one is a HARD task.

I learned to use asciidoc for documentation
I’ve learned how to use NX, a special type of OOP framework devised for Tcl.

Automatic HTML generation

Frameworks exist to help the developer in writing less code.
However most frameworks hide abstractions by actually complicating things.
Generating HTML automatically for you.
I’ve implemented every concievable function in Codru so that I could generate HTML without writing HTML.
This is great. I’ve analyzed other frameworks, most do the same thing.
Programmers are to be lazy it’s said. This is a myth, since programmers need to THINK before they write code.

After a few years working with this system I concluded that generating automatic HTML from your code is not a good thing.
It gets you fixed in using a certain framework or way of thinking.
It forces you to adopt a certain framework like bootstrap,uikit, materialize.
If you want to implement all of them you will need considerable effort to do so.
Whenever the developer wants to use another framework that is not supported he either has to do it himself OR he has to do certain hacks so everything works correctly.

I find that NOT generating HTML for the user is the best way to go.
Instead, write HTML in templates and use views for small functionalities on the server side.
This way you can create your own templates and use basic functionality to implement a project without making it complex.

JavaScript & web frameworks

See Programming languages hypes frameworks, libraries and mega abstractions
Say you need a date and time input form on a page.
To have that you need to load certain frameworks, libraries AND the code.
This means loading as low as 200 KB javascript and 200 KB css for one simple thing?
The whole javascript world has gone mad with grunt, webpack, sass, lass etc.

Why aren’t we writing raw UNIFORM libraries on the backend that actually go through all your website and selects the most used components?
LostMVC - Codru tried to do this and it succeeded, however since most libraries are not written in pure JS but need some other library it complicated matters.

 

Ecosystem Installation & maintenance

Oh, dont get me started on this one.
Installation of the whole ecosystem was bad and cumbersome.

No debian package so I couldn’t do apt-get install. (Nope, no centos package either..)
Nope, compiling from source.
And yeah, I had to compile everything manually.
The only thing that I could install from the apt-get repository was Tcl itself.
Even though that was simple most tcl modules still required compiling. And not to mention the naviserver modules which required compiling.
NX/NSF also required manual compiling, even though i saw that they’ve created packages for it in 2017 (too late..)

I eventually wrote a sort of makefile/automake installer to simplify the compilation process for all the modules.
Yeah, it was a self contained executable using cookit so i could just move it around to install everything for me.

 

Refactoring

Oh, at this time I read a few books about code refactoring
And I started refactoring my code.. Man, what a mess.
At least now I know whenever a function exceeds 20 lines I should probably rewrite it and split the logic.
UPDATE: Thank God Elixir is so great and it already enforces this without you even noticing it by allowing multiple instances of the smae function by using pattern matching!

Conclusions

Did I learn a lot? Of course!
Would I ever build such a framework for a relatively obscure programming language? NO WAY.
I’ve come to appreciate the way the Tcl, Nsf and Naviserver code is written in a way that doesn’t break your apps even if they fully change how things work internally.

Subscribe to my Newsletter

Receive emails about Linux, Programming, Automation, Life tips & Tricks and information about projects I'm working on