Useful code for sharing

Travis' comment in my GPS functionality thread got me thinking about a Git repo of code snippets and samples again and I'm wondering if anyone else is interested. If I set up a git repo on Github, I was thinking that a few of us here could be what Github calls a "Collaborator" with permission to do whatever on the repo and anyone else that wants to contribute would fork the repo and make a pull request. I had originally contributed some stuff to Garmin's repo but it looks like they are keeping that as an "official" repo for use with examples in books and blog posts.

If there is indeed interest, does anyone have thoughts on how it should be organized? The fully working samples obviously would go in their own directories but I'm not sure how best to organize the snippet stuff since it may or may not span multiple files.

If you're interest, please post any thoughts on how to organize this along with your github name and I'll set it up today.

UPDATE: The repo has been created here: https://github.com/douglasr/connectiq-samples

Cheers,
Douglas
  • While having a common place for this makes sense, personally, I'm not a fan of having some things too spread out as far as the internet, github, etc. (another place to find/look at for new folks...)

    What about a new sub forum here named "CIQ Code Snips" or something, where each snip has it's own thread (like apps in the showcase), with a descriptive title? Questions, answers, updates, all in one place that's easy to find/reference from the forum itself (no new id password needed)? Also, if someone finds a better/alternative way to the same thing, it's right there in the same thread. If a developer has a code snip to post, do it there, or if someone finds something useful in the general forum, they can start a "snip" thread about it with a link to the general forum post?
  • While having a common place for this makes sense, personally, I'm not a fan of having some things too spread out as far as the internet, github, etc. (another place to find/look at for new folks...)


    I agree in principle that we don't want stuff spread out everywhere, the problem with the forums (and even a separate sub-forum) is that snippets end up all over various threads and snippets that need to be in separate files make for a convoluted post. I personally feel the forums are best for asking and solving individual issues and isn't necessarily a good place for samples, snippets and/or best practice code. The other issue with the forum is that older posts can get neglected and if there's a bug in a post, only a moderator can go in and fix it up.

    I like what Peter has done in collecting a list of Git repos and blog posts and such but that too requires going to multiple locations.

    What I am proposing only requires going to a single place and a Github account is only required if you want to contribute; you can download the repo anonymously. And a side benefit of using Github is that it gives more exposure to (distributed) source/version control, which every developer should be using, right?

    Cheers,
    DOuglas
  • While it's a noble idea Douglas, I'm a bit pessimistic about it as I don't think it will work...

    * What's usefull? What's not?
    * Even if you could get people to contribute to the repo (I've been in a few group projects on the internet over the years and I've seen many of these projects die, I can assure you getting (other) people to contribute is far from easy! )...
    * ... then I think you're missing another essential thing here: ownership. Ownership is necessary to keep the code maintained (unmaintained code sooner or later breaks, so without ownership the repo ends up as a garbage bin.)
  • While it's a noble idea Douglas, I'm a bit pessimistic about it as I don't think it will work...

    * What's usefull? What's not?
    * Even if you could get people to contribute to the repo (I've been in a few group projects on the internet over the years and I've seen many of these projects die, I can assure you getting (other) people to contribute is far from easy! )...
    * ... then I think you're missing another essential thing here: ownership. Ownership is necessary to keep the code maintained (unmaintained code sooner or later breaks, so without ownership the repo ends up as a garbage bin.)


    That's the beautiful thing about Github. Anyone can fork the repo, make a pull-request and any of the collaborators (with permission) can merge it.

    And github has the tools (wiki, commenting on PRs, etc) to allow discussion on what is useful or not, on what is broken, etc. And with branches we can isolate code that only works on old SDKs, etc.

    Nothing is truly more unmaintained than old forum posts with sample code or advice on workarounds. For example, if you peruse the forums you might think that you need to manually modify the .iq file to handle different versions of your code for different devices but that can now be accomplished with build exclusions.

    As for the project dying or becoming unmaintained, that is certainly possible but it seems a shame not to try something just because it might not work.

    Cheers,
    Douglas
  • I really like this idea! It would be very cool if people would start forking & improving each others code snippets, so everyone (including original contributor) could benefit from code optimizations.
  • I've created a github repo called connectiq-samples. I've started it off with a simple watch face and will be pulling out useful stuff from my various projects as I have time.

    I would love it if others would contribute; simply fork the repo, make changes and/or add code and create a pull request. If you don't want to go through that process, I'd also be happy to add your code/project if you send it to me (email, post a message below or point me to where your code is online). In either case, full credit will be given to whomever the author is.

    Cheers,
    Douglas
  • Former Member
    Former Member over 7 years ago
    I just bought a 935, so I'll start coding stuff for it.


    • I think Github is better than code snippets in a forum.
    • I would like to know under what licence you're sharing code. Without a licence, re-use is difficult. Take a look at https://choosealicense.com, personally I'll use the MIT licence.



    I just got "Hello World" working in the simulator, I hope to be able to contribute and publish something soon. :)
  • I just bought a 935, so I'll start coding stuff for it.


    • I think Github is better than code snippets in a forum.
    • I would like to know under what licence you're sharing code. Without a licence, re-use is difficult. Take a look at https://choosealicense.com, personally I'll use the MIT licence.



    I just got "Hello World" working in the simulator, I hope to be able to contribute and publish something soon. :)


    Awesome! I don't really care what people do with my stuff that I'm putting in there, but I get that some might be concerned without a specific license. I feel that the license should be left up to each individual contributor. I will update the top-level doc/readme to note this. And I'll add the MIT License to my samples.

    Cheers,
    Douglas
  • For those following along, I've updated the repo with better README documentation, including some comments on licensing (my projects there all use the MIT License). I will be going through my projects this weekend and pulling out as much as I can to include as library code and snippets as well as building out some sample projects to cover some common topics from the forums.

    I also got an email from Alpha Monkey Nick approving of the idea/repo and have given him, Ken, Brandon and Kyle admin access as contributors.

    Cheers,
    Douglas
  • Thanks for setting this up dbrobert. We have an "official" and sadly under-utilized repo here https://github.com/garmin/connectiq-apps, but there's a certain kind of freedom that's afforded developers when it's not a Garmin-moderated resource. If I'm able to do some of the things I'd like with our developer site later this year, I'll see about linking to this as our "official-unofficial" repo. :)