Learning to code with Monkey C or is another language better?

Hi, I am interested in learning to create apps for my Garmin watch but have no real experience writing proper code. So far I have managed to modify a popular watchface with code on GitHub with some success. The issue is I am fumbling my way through using lots of Google searches to find answers to problems I encounter along the way without learning any fundamentals of how to structure my code.

The Garmin developer site has lots of good information but it can be a little hard to follow for someone without any proper coding experience. All the searches I’ve done for monkey c tutorials seem to either lead back to the Garmin developer site. Would it be helpful to learn a different language like Java or JavaScript or something else that is more popular than monkey c with more learning resources available, then with that knowledge move to monkey c? If so, what language would be a good place to start?

Brief coding background: during Covid lockdown I wrote a simple text to speech app for my iPhone as a learning exercise. The app worked and I was very happy with my achievement but I felt way out of my league. I am now currently playing with code I found on GitHub for a popular watchface. I’ve managed to modify the code to also display utc time below the local time and be able to optionally select the utc time on and off from the connectiq app on my phone. I uploaded the app as a beta version for my personal use on my own watch for testing. Experimenting with the code from an existing working watchface has been helpful but it’s not teaching me the basics. For example, how and when should I use a class or as function and is it good practice to have a different .mc source file for each class or is it personal preference whether you use multiple source files or a single file?

Any help or advice on a good place to start will be appreciated. 

  • The clear answer is: if you don't know how to code, than almost any other language is better.

  • That's interesting question. From one side, with very limited Monkey C codebase data over the web and very cropped language capabilities, you will never properly learn about data types specifics, data structures, loops, OOP, common programming patterns and other things which are similar for any C-family language.

    From the other side, you can't always write a canonical and nice readable OOP code in Monkey C even if you are an expert, because the device hardware is often too weak to support code patterns which you'd normally use in Java or C#, or Monkey C doesn't support such fearures itself (hello, Monkey C interfaces). So in the real life you'll often try to write code not as it should be correct, but in the way it requires a minimum resources to be executed.

    But yeah, learning some other C-family language before the Monkey C is always the best option, because it opens to you a wider opportunities in the future - the world doesn't end on Garmin watchfaces :)

  • The place I'd start are with the samples in the SDK.  In VSC, See Monkey C: Open Samples Folder.  And keep the Doc like the API Doc handy.

    Also, in VSC, Monkey C: New Project will give you a project of the different app types based on a template in the SDK.

    There are things that you'll learn over time, and things that are not carved in stone, that you can do in different ways..

  • Thank you for the replies. I will look for some online resources to help me learn another language, maybe Java/Javascript or python. There seems to be plenty of information out there for those languages, and then hopefully learn enough to point me in the right direction to write my own Garmin code from scratch. This is purely a hobby for me where the reward can be enjoyed everyday on a device that is always on my wrist. 

  • The only language i knew before MonkeyC was scratch. I’ve used both for my current projects. Scratch to sort data for example.

    I like to take the mad scientist approach.

  • Something to get you started, before you dive into any particular language.

    www.codecademy.com/.../learn-how-to-code

  • maybe Java/Javascript or python

    Just keep in mind Java and Javascript are very different languages (the similarity in names was a deliberate marketing thing ages ago when javascript was new and java was hot.)

    I would start with Python and Javascript. If you enjoy Javascript or see yourself using it for your own projects, you may wish to learn Typescript, as well. 

    You can move onto Java after that, but it’s a very different language than the other two — some developers already consider it to be “legacy” (*). However, Monkey C does have a few things in common with both Java and Javascript.

    (*) In the modern tech workplace, it’s pretty much a rule that everyone knows either Python or Javascript, or both, but it’s almost guaranteed that not everybody knows Java.

    You may find this interesting: [https://survey.stackoverflow.co/2023/#section-most-popular-technologies-programming-scripting-and-markup-languages]

    I’ll echo what was said above how you can’t always write “nice” Monkey C code (the way it was intended by the language designers) due to device resource constraints. Monkey C is also missing quite a few useful features from modern languages, such as string interpolation and functional programming.

    https://developer.garmin.com/connect-iq/monkey-c/

    As Italian and Spanish derive from Latin, Monkey C derives heavily from other popular languages. C, JavaTm, JavaScript, PythonTm, Lua, Ruby, and PHP all influenced the design for Monkey C. If you are familiar with any of those languages, Monkey C should be easy to pick up.

  • Looking at how my kids learn programming (and remembering that back in the '90s I read 2 books about C with a few years between them (and already programming in Basic, Pascal) that set me back for another few years, until there was a very good teacher in the university and I finally understood it) I don't think the main point should be which language resembles Monkey C better. I think the more important question is: what language has a good support (maybe in a non-English native language) for newbies. There you can learn the principles of programming. If you can do it in a way that you also enjoy it and still want to try Monkey C then it was worth it. If not then probably still it was worth it. I think you'll learn more useful things in other languages (I mean things that you'll probably use in 5 years as well) than you would/will in Monkey C. The learning curve of Monkey C is relatively steep even for professionals, because of the lack of documentations, consistency, support. 

  • I think you'll learn more useful things in other languages (I mean things that you'll probably use in 5 years as well) than you would/will in Monkey C

    I agree. Monkey C / CIQ is the last thing I would suggest for noobs to focus on unless they only care about Garmin devices. Personally I think the type of garmin user that even cares about apps (*) has probably moved on to Apple Watch (much like casual runners and fitness junkies who don’t even care about apps), while the type of user that wouldn’t drop Garmin (e.g. serious runners) never cared about apps in the first place. People who will actually use CIQ apps are a tiny minority in an already niche market (that Apple is constantly encroaching on — see: Apple Watch Ultra)

    (* unless ofc they are either married to the garmin ecosystem and/or there's some CIQ app they can't live without.)

    I don’t think it’s a coincidence that Garmin has spent the past few years adding features like music, contactless payment, touchscreens (that actually work well, as opposed to the janky touchscreens of failed older models), AMOLED, and microphone/speaker to its watches, as well as reintroducing the square form factor to the lineup of Garmin watches.

    If Apple releases a triangular watch in the next few years, you can bet Garmin will follow suit shortly.

  • As someone that started coding in the 70's (lots of languages, device and comm drivers, the Smalltalk VM, etc) it probably only took me couple days to write my first CIQ app.  When I started I wrote things very "C" like.  The learning curve was much more the environment than the language, like how widget on a watch time out where they don't in the sim, and how watch faces move between high and low power (that's manual in the sim).  The kind of stuff where knowing another language doesn't really help.