Why I do think respecting closely the template is really important

Hello all!

I want to share my POV (already shared on IRC). I’m a simple maintainer for zabbix app, I propose some evolution but nothing very impressive.
I’m an adminsys but I’ve had very good and intensive training (3 years) in coding, I’v learned best practices, functions, procedures, return code, exceptions, etc. Today, my package works : I have a level 7 since 14 or 16 months but I want to clean my old code, make it simple to read with the best integration of officials helpers and best practices. I want to make it simple but I have not this philosophy of “no function”, “read one script file is enough”. Yes, There are advantages in this conception but you must duplicate the code when restore script use a major part of remove script install script, upgrade use same controls, patch as install.
So, no this is not a good conception for me. We must follow an example (example_ynh), with strict rules and I agree with that. I agree with a cleaning code and “kiss” conception, but we can write a “beautiful”, comprehensive code with the respect of best practices like :

  • Nomenclature functions/procedures, for extra files, directories (why not, based on helpers syntax for functions/procedure)
  • Functions and procedures
  • Code return (with standard code, and why not Yunohost specific code)
  • Comments, in English by default, and in other languages why not?

You can see these standards in this page https://en.wikipedia.org/wiki/Best_coding_practices#Coding_standards
Today, a user can read a package source code, but to know and apply Yunohost helpers, you must to have experience : the documentation is great but it’s not enough for a beginner. Moreover, there’s a lot of operation that can’t be done with official helpers : mysql queries, sed with number of line, use apt-get to get somethings, etc. and you don’t have to create a helper for anything! Helpers are smart tools, I like them with real love, but It’s not enough. Then, If you must use 15-20 helpers to do the same think in your install file and your upgrade/restore file, you gain in reading and maintenance to store them in a procedure or function with a good same, good comment, ect. You avoid duplicate code : if you modify your function, you won’t forget to modify one of your scripts.

This is my opinion.

1 Like