4

Disclaimer: the project I'm about to mention contains the first lines of Go I have ever written.
Still, I'm quite proud of how quickly I got it working considering it's also my first time working with GTK.

This project that I've been working on the past few days is finally done. But it's %50 percent spaghetti, so refactoring time. I decided to have a look at my cyclomatic complexity numbers, and my biggest function (not main()) had it at 7.

As it was quite large, I split it up into to parts: the preparation and the actual timer loop. As I appear to need to use a goroutine, by the time I'm done passing channels and all hell to handle them, my loop function now has a score of 9 for cyclomatic complexity.

So fix one bug, leaves two in its place?

But I still need to better learn Go, anyone have a good (relatively painless, informative, quick-ish) course they can recommend? I've been thinking of trying out codecademy's one...

Comments
  • 2
    %50 🤔
  • 0
    @electrineer Well, when I started this out, I didn't know Go or Gotk3, so I started from an example. So, as I started to get more familiar with the language (and module), it became much easier to produce cleaner code.
  • 1
    Wait... Go... And .... GTK... Por que?
  • 0
    Why Go with Gtk??? I mean so many good choices out there to use with Gtk: C, C++, Vala, Rust, Python, JS...
  • 0
    @aggelalex because I want to learn Go.

    What's the problem with Go and GTK?
  • 0
    @chabad360 Nothing, other than that I think the others have better Gtk support.
Add Comment