Mailing List Archive

Fwd: Re: [Wikidata] Imperative programming in Lua, do we really want it?
Following your message Jeroen, there it also is on Wikitech-l now.

-------- Message transféré --------
Sujet : Re: [Wikidata] Imperative programming in Lua, do we really want
it?
Date : Wed, 6 Dec 2017 23:53:17 +0100
De : Jeroen De Dauw <jeroendedauw@gmail.com>
Répondre à : Discussion list for the Wikidata project.
<wikidata@lists.wikimedia.org>
Pour : Discussion list for the Wikidata project.
<wikidata@lists.wikimedia.org>



Hey,

While I am not up to speed with the Lua surrounding Wikidata or
MediaWiki, I support the call for avoiding overly imperative code where
possible.

Most Lua code I have seen in the past (which has nothing to do with
MediaWiki) was very imperative, procedural and statefull. Those are
things you want to avoid if you want your code to be maintainable, easy
to understand and testable. Since Lua supports OO and functional styles,
the language is not an excuse for throwing well establishes software
development practices out of the window.

If the code is currently procedural, I would recommend establishing that
new code should not be procedural and have automawted tests unless there
is very good reason to make an exception. If some of this code is
written by people not familiar with software development, it is also
important to create good examples for them and provide guidance so they
do not unknowingly copy and adopt poor practices/styles.

John, perhaps you can link the code that caused you to start this thread
so that there is something more concrete to discuss?

(This is just my personal opinion, not some official statement from
Wikimedia Deutschland)

PS: I just noticed this is the Wikidata mailing list and not the
Wikidata-tech one :(

Cheers

--
Jeroen De Dauw | https://entropywins.wtf |https://keybase.io/jeroendedauw
Software craftsmanship advocate | Developer at Wikimedia Germany
~=[,,_,,]:3

On 6 December 2017 at 23:31, John Erling Blad <jeblad@gmail.com
<mailto:jeblad@gmail.com>> wrote:

With the current Lua environment we have ended up with an imperative
programming style in the modules. That invites to statefull objects,
which does not create easilly testable libraries.

Do we have some ideas on how to avoid this, or is it simply the way
things are in Lua? I would really like functional programming with
chainable calls, but other might want something different?

John

_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org <mailto:Wikidata@lists.wikimedia.org>
https://lists.wikimedia.org/mailman/listinfo/wikidata
<https://lists.wikimedia.org/mailman/listinfo/wikidata>
Re: Fwd: Re: [Wikidata] Imperative programming in Lua, do we really want it? [ In reply to ]
Lua is used for many purposes - some of which I think are well suited to an
imperaive approach (or at least would be totally fine to do in an
imperative style). There are of course many cases where an imperative
approach would be a poor choice.

There are no rules that apply to all programming things equally - context
of the programming task matters.

--
bawolff

On Thursday, December 7, 2017, mathieu stumpf guntz <
psychoslave@culture-libre.org> wrote:
> Following your message Jeroen, there it also is on Wikitech-l now.
>
> -------- Message transféré --------
> Sujet : Re: [Wikidata] Imperative programming in Lua, do we
really want it?
> Date : Wed, 6 Dec 2017 23:53:17 +0100
> De : Jeroen De Dauw <jeroendedauw@gmail.com>
> Répondre à : Discussion list for the Wikidata project. <
wikidata@lists.wikimedia.org>
> Pour : Discussion list for the Wikidata project. <
wikidata@lists.wikimedia.org>
>
>
>
> Hey,
>
> While I am not up to speed with the Lua surrounding Wikidata or
MediaWiki, I support the call for avoiding overly imperative code where
possible.
>
> Most Lua code I have seen in the past (which has nothing to do with
MediaWiki) was very imperative, procedural and statefull. Those are things
you want to avoid if you want your code to be maintainable, easy to
understand and testable. Since Lua supports OO and functional styles, the
language is not an excuse for throwing well establishes software
development practices out of the window.
>
> If the code is currently procedural, I would recommend establishing that
new code should not be procedural and have automawted tests unless there is
very good reason to make an exception. If some of this code is written by
people not familiar with software development, it is also important to
create good examples for them and provide guidance so they do not
unknowingly copy and adopt poor practices/styles.
>
> John, perhaps you can link the code that caused you to start this thread
so that there is something more concrete to discuss?
>
> (This is just my personal opinion, not some official statement from
Wikimedia Deutschland)
>
> PS: I just noticed this is the Wikidata mailing list and not the
Wikidata-tech one :(
>
> Cheers
>
> --
> Jeroen De Dauw | https://entropywins.wtf |https://keybase.io/jeroendedauw
> Software craftsmanship advocate | Developer at Wikimedia Germany
> ~=[,,_,,]:3
>
> On 6 December 2017 at 23:31, John Erling Blad <jeblad@gmail.com <mailto:
jeblad@gmail.com>> wrote:
>
> With the current Lua environment we have ended up with an imperative
> programming style in the modules. That invites to statefull objects,
> which does not create easilly testable libraries.
>
> Do we have some ideas on how to avoid this, or is it simply the way
> things are in Lua? I would really like functional programming with
> chainable calls, but other might want something different?
>
> John
>
> _______________________________________________
> Wikidata mailing list
> Wikidata@lists.wikimedia.org <mailto:Wikidata@lists.wikimedia.org>
> https://lists.wikimedia.org/mailman/listinfo/wikidata
> <https://lists.wikimedia.org/mailman/listinfo/wikidata>
>
>
>
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l