[Koha-devel] tt style point

Colin Campbell colin.campbell at ptfs-europe.com
Fri Sep 16 14:13:57 CEST 2011


Hi
  I noticed that in QA someone is changing tt constructs from
[% IF variable %]
to
[% IF (variable) %]
as style issues

I think this is very bad style for the following reasons:
You'll not see it in any of the documentation for tt either the perldoc,
on the tt site or in the badger book. (and I've never seen it on any tt
using project).
It adds nothing (we hope) syntactically.
My initial response is that as we are not using normal tt syntax,
something "clever" or magic is going on here rather than a usual [% IF %]
It detracts from readability. (ok slightly subjective but the
environment already makes full use of the top row of the keyboard.)
Whats its relation with the legitimate use of brackets e.g. to call
vmethods in regexps [% IF variable1( variable2 ) %]
The authors didn't require brackets around more complex boolean
expressions [% IF variable == 0 %] why bring em back in for simple
variables.
Could it have unforeseen side effects (don't know but I don't want to
spend time researching it)
It confuses the reader of the code and the writer of subsequent code -
'should I use () no? when? why?
It strikes me as weird (!!)

In short I'm arguing for clarity...

I realise that Chris bracketed things in the great template conversion
but I think that was defensive programming when he couldn't rely on
variable always being one. And we shouldn't be encouraging or enforcing
others to use a peculiar idiolect rather than standard practice.

Colin


-- 
Colin Campbell
Chief Software Engineer,
PTFS Europe Limited
Content Management and Library Solutions
+44 (0) 845 557 5634 (phone)
+44 (0) 7759 633626  (mobile)
colin.campbell at ptfs-europe.com
skype: colin_campbell2

http://www.ptfs-europe.com


More information about the Koha-devel mailing list