Tuesday 16th May, 2017
Show and Tell 32
- When: Wed 10 May, 2017
- Where: Forge and Co, 154-158 Shoreditch High St, London E1 6HU
- Links: attending.io
- Attendees: Ben G, Chris, Leo, James M, Tom S, Paul P
James M - Sequence diagrams
I’ve always thought the most useful UML diagram is the Sequence Diagram. Many years ago I played around with the idea of generating a sequence diagram by tracing application execution, mainly in the context of characterising automated tests.
Recently we’ve been busy refactoring a legacy Rails web app in which most requests were handled by a very large number of objects, i.e. many, many levels of indirection. Early on in the process I often found myself sketching sequence diagrams to help me understand what was going on. So I’ve recently been playing around again with the idea of generating such diagrams by tracing application execution.
I demonstrated using Ruby 2’s TracePoint to generate output suitable for js-sequence-diagrams, firstly for a single web request using Rack middleware and then for a set of specs using an RSpec around hook.
This was definitely a work-in-progress and not a polished solution, but I was keen to get some feedback on whether people thought it could be useful. One of the main problems I’d run into was how cluttered the diagrams are with calls to objects outside the application, i.e. objects in Rails, other gems, and the Ruby standard library. I’d made some attempt to remove this clutter, but there’s more work to do on that front.
I’m keen to take this work a bit further and, for example, implement an RSpec formatter to output sequence diagrams for specs.
Paul P - Pitch to BBC
Paul took us through a presentation which he had previously used in a pitch to the BBC. The competitive brief for which his previous company had pitched was to encourage online participation by “makers” following the success of shows like The Great British Bake-off. It was interesting to hear him explain how he’d made some of the slides.
Paul mainly uses Photoshop and Illustrator (he says this is “old school” compared to the currently-popular Sketch). One approach was to take photos and trace over them to creating pencil-like drawings. These help to turn attention away from the person in the photo and onto the device they’re holding. Another approach was to use a collection of vector images in Illustrator to create some isometric perspective illustrations of the applications in use in physical spaces.
Ultimately they didn’t win the bid and as a result these slides will probably never see the light of day again. It’s a bit sad to think of all the work that goes into presentations like this which never get a wider audience.
Ben explained how he’d built a temperature logger using a Particle Photon board with a temperature sensor connected via the Grove system. He also connected a 4-digit display to display the current temperature.
He had to write a bit of code and use a bit of trial and error to convert the input signal from the temperature sensor into degrees Celsius, but it was then relatively trivial to display that figure and send it to the Particle cloud.
He had then used an IFTTT applet to write each Particle event to a Google Spreadsheet. This means that each time the app running the Photon board sends a value to the Particle cloud, that value is written to a new row in a Google spreadsheet.
Apparently the temperature sensor was accidentally hidden behind some furniture and was forgotten for some months. Ben discovered that the IFTTT applet had reached the maximum number of rows in a Google spreadsheet and had been forced to create several more spreadsheets!
Next I asked Ben about a tweet he’d sent about giving programming advice to his son. Apparently there’s a running joke in his household that all his son’s homework assignments are turned into computer projects. In the week in question, his son was supposed to be learning about Tutankhamun, so he built a quiz game using Scratch which asked questions about the pharaoh. There was a picture of an Egyptian mummy and if you got a question wrong, some of the bandages were removed hangman-style to reveal a skeleton.
At one point Ben suggested his son could remove a line of code, but his son (correctly) said that removing it would break the program and followed that by saying “Is this really your job, Dad?”! Ben explained this by saying that his son can keep much more stuff in his head at one time than Ben can. I definitely know this feeling! Anyway, kudos to Ben for sharing this moment!
Tom S - Ikea Trådfri
First Tom setup two of the Trådfri wireless bulbs and showed us how to control them with the wireless dimmer. The latter is just a disc which contains an accelerometer and you can control any paired bulbs by rotating it in any orientation - it’s actually pretty cool! He said he wanted to make it clear that you don’t need the Trådfri gateway to do this, because that isn’t made clear on the website.
Next he showed us how you can use the gateway in conjunction with a wireless access point to control the bulbs individually from an app on your phone via the wireless network (no internet required). As well as turning the bulbs on/off and controlling their brightness, you can also control their colour temperature.
Apparently the gateway, dimmer and bulbs all communicate over a Zigbee wireless network using the HTTP-like CoAP protocol over UDP encrypted using DTLS. Tom has written a Ruby gem to allow you to control the bulbs from a Ruby application. The gem talks to the gateway by shelling out to the
coap-client program that comes with
libcoap. The gateway advertises itself with DNS-SD, so the gem can discover it automatically without you having to specify an IP address. To demonstrate the gem, he ran a script which looped through the bulbs randomly setting their brightness and colour temperature.
Lastly, Tom explained that he had used his gem to integrate his Trådfri lighting system with a HomeKit bridge (maybe this one?) running on a Raspberry Pi. This allows him to set different lighting configurations triggered things like the time of day, a geo-fence, etc.
Usually after the meeting we retire to the bar downstairs at Forge & Co for a drink or two, but this time it was pretty packed, so we headed to the Reliance instead where we found a table upstairs.
Show & Tell 33
Please get in touch if you’re interested in joining us for the next Show & Tell on Wednesday, 14th June 2017.