273: Off the Topic of My Jammies
Embedded11 Tammi 2019

273: Off the Topic of My Jammies

Chris and Elecia chat with each other about the new year. All is fine until she starts quizzing him about some language details of his new project.

Many object-oriented resources suggest using composition (has-a) over inheritance (is-a-type-of) (wiki). Where do swift extensions fit in? It seems to me (Elecia here) that extension is invisible composition that allows adding of functions.

For example, say you want a TiltSensor and you already have an ImuSensor object so you need to add a function for TiltComputation.

You could make the TiltSensor contain an ImuSensor (composition). You call the ImuSensor functions to check the readings when running TiltComputation function. You don't need to know what is in ImuSensor, only what the API is.

You could have TiltSensor be a child class of ImuSensor (inheritance) so that TiltSensor responds to all ImuSensor functions as well as its new TiltComputation function. You could use the variables in ImuSensor directly for TiltCompulation but you will need to know what is in ImuSensor for that to work.

Or, in Swift, you could have TiltSensor be an extension of ImuSensor. Except it wouldn't be called TiltSensor, it would be part of ImuSensor: any file that had access to your extensions would be able to create an ImuSensor instance and call TiltComputation as if it was part of the original ImuSensor API. The TiltComputation function would only have access to its extension's variables and ImuSensor's API. You get to add new functionality without breaking backward compatibility.

Some more resources on this topic:

Swift Programming: The Big Nerd Ranch Guide by Matthew Mathias and John Gallagher

iOS Programming: The Big Nerd Ranch Guide by Christian Keur and Aaron Hillegass

LinkedIn Learning Courses

Blender Beta with EEVEE renderer

The Clean Coder: A Code of Conduct for Professional Programmers by Robert C. Martin

Code Complete: A Practical Handbook of Software Construction by Steve McConnell

Gelly Roll Glitter Pens (by Sakura)

Google Podcast Link (or see the Subscribe page)

Jaksot(567)

520: All Sorts of Interesting Facts About Teeth

520: All Sorts of Interesting Facts About Teeth

Chris and Elecia apologize, discuss uses and abuses of chatbots, reach out to an uncertain manager, try to help someone out of their professor's draconian rules, and extol the joys of reading.  Chabot...

6 Helmi 58min

519: The Password Is All Zeros

519: The Password Is All Zeros

Mark Omo and James Rowley spoke with us about safecracking, security, and the ethics of doing a bad job. Mark and James gave an excellent talk on the development of their safecracking tools at DEF CON...

23 Tammi 1h 6min

518: Nothing We Can Do About Frogs

518: Nothing We Can Do About Frogs

James Cameron spoke with us about programming for and operating a large telescope. The show is a blend of astronomy, engineering on the fly, and weird lady bug habitats.  The Anglo-Australian Telescop...

9 Tammi 1h 8min

517: A Direct, Sensible Podcast

517: A Direct, Sensible Podcast

Nathan Jones and Chris Svec give Chris and Elecia their 2025 performance review.  Donations went to Elevate Tutoring, an organization that provides funding and support to low-income and first-generati...

2 Tammi 1h 1min

516: Voices From the Cataclysms of the Universe

516: Voices From the Cataclysms of the Universe

Sophi Kravitz joined us to talk about art, science, and engineering.  You can see Messages from Space on Sophi's website /sophikravitz.com). A subset of the artwork had a short stay for a demo at Chab...

12 Joulu 202558min

515: Script Boomers

515: Script Boomers

Nick Kartsioukas joined us to talk about security in embedded systems.  Common Vulnerabilities and Exposures (CVE) is the primary database to check your software libraries, tools, and OSs: cve.org. Op...

27 Marras 20251h 10min

514: Just Turn Off All the Computers

514: Just Turn Off All the Computers

Philip Koopman joined us to talk about embedded systems becoming embodied and intelligent. We focus on the safety considerations of making an intelligent and embodied device.  Phil's new book is Embo...

14 Marras 20251h 10min

513: I'm Sorry You Learned Something

513: I'm Sorry You Learned Something

Jason Turner of C++ Weekly and Empty Crate spoke with us about the joy of puzzles, the changing directions of an interesting career, and the C++ programming language. I mean, of course we talked about...

30 Loka 20251h 17min

Suosittua kategoriassa Tiede

rss-mita-tulisi-tietaa
rss-poliisin-mieli
tiedekulma-podcast
rss-duodecim-lehti
docemilia
rss-lihavuudesta-podcast
utelias-mieli
radio-antro
rss-sosiopodi
sotataidon-ytimessa
mielipaivakirja
filocast-filosofian-perusteet
rss-laakaripodi
rss-radplus
rss-opeklubi
rss-luontopodi-samuel-glassar-tutkii-luonnon-ihmeita