Published on

Everyone Struggles

Authors
  • avatar
    Name
    Idara Nabuk
    Twitter

When I started my Outreachy internship with OCaml, I was both excited and anxious. Lots of thoughts ran through my mind every day; what would the internship be like?, what tasks would I be assigned? Would I be capable of solving them? who are my mentors and what will be their reaction to my naivity? Believe me, the questions were almost endless.

The Struggle

One may be wondering why the worry. Well, OCaml was very new to me, I was very unfamiliar with the syntax, expressions, and libraries. I had to and I'm still taking many tutorials; from video lectures to reading documentaries and studying the libraries.

The tasks we were saddled with during the contribution phase were a bit easier in that we were given a kind of roadmap for each task, you get to be told what files need to be changed most times.

Coming into the internship proper was a bit more confusing as I had the full picture of things now presented to me though I was to focus on the GUI libraries. I was so overwhelmed come the first two weeks if not the first month of my internship.

The Ease

Fast forward to when I finally met my mentors in the first week of my internship, my initial fears were allayed. My mentors were so friendly and accommodating. They made me feel relaxed and gave me the necessary encouragement and resources that I needed to make things easier for me.

I was given tasks per time to focus on while studying and getting acquainted with the OCaml language and libraries. They are very prompt in giving responses to my questions and offering help at every point necessary.

Pair programming sessions are always organized to teach me a thing or two, and all these came in handy in relieving me of all the worries and fears that I had earlier on.

My Learning Experience

laughs! I wouldn't just mention a word that I wasn't familiar with when I began my internship, but I will be mentioning words. As I said earlier, OCaml was very new to me, so I wasn't acquainted with many terms. Vocabulary like Unix, drift, connect, layout, action, draw, ignore, resident to mention but a few.

And it's not just the words in themselves that were unfamiliar to me, but the usage of these words in the language. It has been very interesting and challenging, and I so much love the fact that I'm learning something new and building something with it.

Here's a little example of building a GUI that displays "Hello World" in ocaml using the Bogue library:

open Bogue

let () =
Widget.label "Hello world"
|> Layout.resident
|> Bogue.of_layout
|> Bogue.run

Let me break down what the above code is doing:

open Bogue

This line imports the Bogue library into the current scope, so you can use its functions directly.

let () =

This is the entry point of the code and defines the return value which is of type unit (). This line defines the value of the expressions on the right. It's a pattern match of the form let pattern = expression. Bogue.run will return a unit () and this will match with the unit () on the left and the compiler will be happy and we will have our side-effects from Bogue.run.

Widget.label "Hello world"

This line creates a new label widget (a GUI element that displays text) with the text “Hello world”.

|> Layout.resident

The |> operator is used for function application in OCaml. It takes the result of the expression on its left (the label widget) and applies it as an argument to the function on its right. In this case, Layout.resident makes the label widget a resident of the layout, which means it will be displayed in the GUI.

|> Bogue.of_layout

This line converts the layout (which now contains the label widget) into a Bogue GUI.

|> Bogue.run

Finally, this line runs the Bogue GUI. This will open a window and display the “Hello world” label.

This is a very minimal code example that you'll also see in Bogue's documentation. In my subsequent post, I'll be delving into some sophisticated code in the Bogue library, but for now, digest this one.

Conclusion

It is said that "The journey of a thousand miles begins with a step", and rightly so. When I started out in my internship, everything was so overwhelming, or would I say confusing, but with a lot of determination and focus, everything began to unfold and become clearer. In the words of Napoleon Hill "Strength and growth only come through continuous effort and struggle.", and now I can affirm that saying.