[Engineering] [Talk] What is functional programming? (17')

Guillaume Lederrey glederrey at wikimedia.org
Tue Apr 19 09:53:42 UTC 2016


On Tue, Apr 19, 2016 at 10:44 AM, Joaquin Oltra Hernandez
<jhernandez at wikimedia.org> wrote:
> Great talk, mostly about testing though, but very clear explanation of the
> different types of tests, and when and for what to rely on them.
>
> I didn't agree too much with his dependency injection arguments, since they
> are only valid for staticly typed languages without monkey patching
> facilities. As the ruby guy mentioned, a solid framework (like rspec) makes
> monkey patching for testing very solid and the pro is that it reduces the
> impact of the tests on your code (in the sense of having to change code to
> acomodate testability, like with dependency injection).

That's one of my favorite subject: why do we unit test... The obvious
answer is "to ensure our code is correct". And I would argue that
correctness is a side benefit of unit testing, but not the main reason
why we do it. The main reason why we do unit test is to ensure that
our code is testable. Testable code means the code is modular. That
you can clearly identify the boundaries and responsibilities.
Dependency inversion for example is not about making your code
testable, it is about making your code modular, more reuseable. And
the side benefit of dependency inversion is that your code is more
testable.

In the end, unit testing is probably the best measure of modularity...

> I have another awesome talk to suggest that bonds both that we've posted,
> Boundaries by Gary Bernhardt (youtube, talk with code examples 45' ||
> destroyallsoftware, just the talk 30'). This one is one of my favorite ones.
>
> Summary: This talk is about using simple values (as opposed to complex
> objects) not just for holding data, but also as the boundaries between
> components and subsystems. It moves through many topics: functional
> programming; mutability's relationship to OO; isolated unit testing with and
> without test doubles; and concurrency, to name some bar.
>
> On Mon, Apr 18, 2016 at 8:33 PM, Stephen Niedzielski
> <sniedzielski at wikimedia.org> wrote:
>>
>> This is great! Functional programming is really awesome. Your video
>> reminded me of an exemplary, longer form talk by the AngularJS guy on
>> dependency seams and testing:
>>
>> https://www.youtube.com/watch?v=wEhu57pih5w
>>
>> It's a little longer but a life changer if you haven't thought about
>> testability in depth.
>>
>> On Mon, Apr 18, 2016 at 2:41 AM, Joaquin Oltra Hernandez
>> <jhernandez at wikimedia.org> wrote:
>>>
>>> I've come across this lovely little talk (british accent +1) that
>>> explains what is functional programming quite clearly in my opinion. Worth a
>>> watch.
>>>
>>> Kris Jenkins: What is Functional Programming?
>>> https://www.youtube.com/watch?v=tQRtTSIpye4
>>>
>>> Takeaway: Functional programming is about eliminating side-effects where
>>> you can, controlling them where you cant.
>>>
>>> _______________________________________________
>>> Engineering mailing list
>>> Engineering at lists.wikimedia.org
>>> https://lists.wikimedia.org/mailman/listinfo/engineering
>>>
>>
>
>
> _______________________________________________
> Engineering mailing list
> Engineering at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/engineering
>



-- 
Guillaume Lederrey
Operations Engineer, Discovery
Wikimedia Foundation



More information about the Engineering mailing list