Scott Penrose

Programming2016

Scott Penrose is a perl hacker with an interest in home automation. He has been playing with electronics since he was old enough to burn his fingers with a soldering iron.

There is always a lot to learn. Here is my advice from 2016 projects.

Languages

  • Perl 6 - is amazing, but I am not yet comfortable to use in large projects with other people. Keep an eye on it.
  • NodeJS - Majority of my server side code, and even embedded, is being done in Javascript on NodeJS.
  • C/C++ - Still using lots of C and C++ for Embedded special code on AVRs and even capture code in Embedded Linux systems
  • Golang - This is a growing language, which I think of as a compiled version of Node (sounds silly, but I have good reasons)

Web and Web services

  • API: All server side code produces JSON via API and can be consumed by servers or Clients
  • API: on Node and Golang should be documented Swagger
  • HTML: Generated HTML and CSS with Jade and Less - but statically generated and cached. It is useful for generating different JS files for production vs testing (e.g. Merged and compressed files).
  • Javascript; Used to generate all user interfaces.

Techniques

These techniques apply best to NodeJS and Golang development - which is where I am spending most of my time.

  • Callbacks - Learn to love them.
  • Events - Make your own.
  • Async Library

Events

So you want one object to talk to another. One really nice way to do this in asyncronous, non-blocking languages is to pass callbacks all around. This can be hard, because you have not created one, before the other. Instead both object can listen and work with each other by having the top level code that creates them, listen to events. It is a smoother and more flexible approach, and is especially useful for optional events - e.g. adding logging.