Resources for learning to code


(Marc Janisse) #1

Hi there,

I’m new to Smartthings and home automation. I’m a big fan, but think it’s got a long ways to being a mainstream product. I think it’s going to be critical to hide the complexity of the underlying code to get this to be a real consumer device. There isn’t quite enough flexibility out of the box yet. I still think I can make it work the way I want in the interim, if I don’t mind going outside my comfort zone and learning a little.

I’m not a developer by any means, although I’m not completely unfamiliar with hacking other people’s code to do what I want. In trying to get myself through some of the SmartApp programming though, I realize I’ve got some catch up to do. I’m curious what resources the community would suggest for a crash course in Groovy and probably more basically Object Oriented Programming. Any good recommendations out there aside from the codehaus tutorials? I’ve been through the workshop video, which was very helpful, and I’d like to see more of those! Anything else?

Thanks!
Marc


(Nicholas Wilde) #2

I took an introductory course to Android programming at Coursera, which offer free classes. I’m not sure if they offer anything in Groovy, however. I find looking at other people’s examples and getting help on the ST forums or other help sites - e.g. Stack Overflow - is the easiest way to get started.


(Patrick Stuart [@pstuart]) #3

Honestly, just get in and play. Pick specific apps / tasks you want to do and figure it out…

Classes are great, but will get you thinking down a narrow channel, code is code, but the computer science behind it is practically universal (sans postscript, that stuff is backwards).

Learn as much as you can about boolean logic, if then statements, case/switch statements, while loops, etc.

Understanding data types, integers, strings, etc and how to compare and manipulate them is another important skill to have.

Calling functions, testing methods, debugging and troubleshooting are the next level…

Honestly, javascript might be the best place to start, built into every browser, requires nothing but a text editor and browser, all modern browsers have built in consoles and debuggers (F12) to get you figuring things out…

Learn the science, then you can learn almost any language because that is just syntax.


(Chrisb) #4

Look for these programs in the shared smartapps section:

Wireless 3-Way
Nightlight
Unlock when Garage Door Opens
Goodnight Ubi

These are four relatively small SmartApps that I wrote that include HUGE amounts of documentation. They should be able to give you a bit of a start on figuring out what the different parts of the SmartApp are for and how to do some of the basics.

If you’ve coded before, or hacked around with others code, it should be enough to get you started.


(Marc Janisse) #5

Thanks for the great tips! I agree that I’ll likely get the most from actually hacking/writing the code itself. I will absolutely have a look at those shared smartapps.

I’ve done some basic BASH/PERL scripting and C++ programming, so it’s not completely foreign. I get most of the basic concepts of data types and constructs, boolean logic etc. I still think of this stuff pretty linearly though. I was talking to a colleague that does much more of this about the code, including showing him a couple of example apps, and I ended up lost in our conversation because of what appears to be OOP lingo (class, method/function). I then got myself in the weeds trying to understand some of the syntax differences def/private, what ties all the methods together… It gets overwhelming. I have no doubt I’ll get it though.

Thanks again for the feedback and options. I will hack away and ask questions as necessary. By all accounts I’ve read so far the community here is outstanding.