Now that I've gotten through my basic steps to "learn" a new programming language, I'm ready to actually start learning the language. What do I mean by this? When I studied martial arts, my teacher always said "You don't start learning something until you've done it 10,000 times." This seems like an exaggeration, but it's true!
When learning something, one needs time with it to truly learn it. One learning to play an instrument must practice regularly to get good at playing the instrument. Someone learning to cook has to cook regularly to get better at it. It is the same with learning a new programming language. You need to work with it regularly to get better at it.
Now, repetition is good, but that repetition needs feedback for improvement to happen. For me with programming, unit testing provides that feedback. Unit tests help me know if my solution works, if my code is too complicated, and if my design is moderately reasonable. This is why learning a unit testing framework in a new language is an early step for me.
The rest of the "learning" steps that I've documented are a means to an end. Knowing how to interact with files, or a database, or a web API in a new programming language provides me the tools to use the language in real-world scenarios.
The .NET ecosystem provides some easy, low-cost ways to use F# in real-world scenarios. First, the .NET command line tool provides a REPL (Read-Eval-Print-Loop) for F#. This tool allows you to run F# code interactively in a terminal window. You access the REPL with the command:
dotnet fsiYou can access packages using the #r directive. In the REPL environment, the #r directive references a DLL somewhere on disk, using the full path to the DLL. You can then use the Open keyword to make the namespace available from the referenced DLL.
The REPL also provides an ability to run F# scripts. An F# script file is designated with an fsx extension. It can be run from the command line with a call like:
dotnet fsi my_fsharp_script.fsxThis can be handy for day-to-day scripting tasks, and provides a way to practice with F#. (I documented a recent instance of this for me here.
As I continue to work with F# and really learn the language, I will continue to document what I'm learning.
No comments:
Post a Comment