I have no easy solutions either but one observation:

Copy paste culture seems to be huge on wiki* and people want to get stuff
done quickly. So a common practice is to search for something, tweak it and
move on.
Inferring from own experience: This style is probably easier with
procedural code.
I assume that non-professional web development and data analysis code for
scientific projects employs similar practices. They also share the same
pattern that people very graspably want to get a non-programming thing
done: See their website, publish a paper…

A possible improvement could be providing special purpose, domain centered
libraries that encapsulate common patterns. Look at bootstrap (CSS//HTML),
jquery (JavaScript), dplyr and the like for common data analysis tasks in
the R language. With these libraries you can often write a maintanable,
terse and as-easy-to-read-as-procedural-for-not-programming-pros style.

Jan


2017-12-07 19:24 GMT+00:00 John Erling Blad <jeb...@gmail.com>:

> There are some really weird modules out there, I'm not sure whether it
> makes a good discussion environment to point them out.
>
> My wild guess is that the modules turn into an imperative style because
> the libraries (including Wikibase), returns fragments of large table
> structures. To process the fragments you then do iterations where different
> subparts of those tables are extracted, keeping a state for whatever you
> infer from those calls. This creates a lot of extracted states, and often
> the states exists inside calls you can't test. Usually you can't even get
> to those calls without breaking the interface *somehow*.
>
> Perhaps something can be done by writing a few example pages on Mediawiki,
> but my experience is that developers at Wikipedia (aka script kiddies like
> me) does not check pages at Mediawiki, they just assume they do it
> TheRightWay™. Writhing a set of programming manuals can thus easily become
> a complete waste of time.
>
> No, I don't have any easy solutions.
>
>
>
> On Wed, Dec 6, 2017 at 11:53 PM, Jeroen De Dauw <jeroended...@gmail.com>
> wrote:
>
>> 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 | ht
>> tps://keybase.io/jeroendedauw
>> Software craftsmanship advocate | Developer at Wikimedia Germany
>> ~=[,,_,,]:3
>>
>> On 6 December 2017 at 23:31, John Erling Blad <jeb...@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
>>> https://lists.wikimedia.org/mailman/listinfo/wikidata
>>>
>>>
>>
>> _______________________________________________
>> Wikidata mailing list
>> Wikidata@lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/wikidata
>>
>>
>
> _______________________________________________
> Wikidata mailing list
> Wikidata@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikidata
>
>


-- 
Jan Dittrich
UX Design/ User Research

Wikimedia Deutschland e.V. | Tempelhofer Ufer 23-24 | 10963 Berlin
Phone: +49 (0)30 219 158 26-0
http://wikimedia.de

Imagine a world, in which every single human being can freely share in the
sum of all knowledge. That‘s our commitment.

Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e. V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg unter
der Nummer 23855 B. Als gemeinnützig anerkannt durch das Finanzamt für
Körperschaften I Berlin, Steuernummer 27/029/42207.
_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata

Reply via email to