underlap,
@underlap@fosstodon.org avatar

1/3 In today's functional programming class we covered file IO in Haskell.

I repeatedly emphasised that for small files, it is much easier to read and write whole files using a single function rather than opening the file, using the file handle, and then closing the file.

underlap,
@underlap@fosstodon.org avatar

2/3 I then set them an exercise and more than one of them chose to do it the hard way. When I showed them my trivial solution, they were shocked.

underlap,
@underlap@fosstodon.org avatar

3/3 It seems that they are used to writing a fair bit of code, e.g. in C#, to achieve anything useful. I need to help them unlearn this habit.

pmidden,
@pmidden@fosstodon.org avatar

@underlap could also be thoughts about premature optimization. I see this very often with novice programmers (of any language).

yplog,
@yplog@fosstodon.org avatar

@underlap Changing habits in functional programming can be challenging for beginners. Two books that have been very helpful for me in this process:

  • Simplicity - Taming Complex Software With Functional Thinking by Eric Normand
  • Functional Programming by Michał Płachta.
underlap,
@underlap@fosstodon.org avatar

@yplog @pmidden Some data structure and (easy) monad exercises for my functional programming students today.

A few times I heard the remark "Oh, so you just have to ..." when a student was surprised by the simplicity of the code involved.

I hope they internalise the feeling of really grokking a problem and coding up a neat solution (in whatever language). We'll make programmers of them yet...

  • All
  • Subscribed
  • Moderated
  • Favorites
  • haskell
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines