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(569)

498: To Consume Stickers

498: To Consume Stickers

At the end of this week's show, Elecia reads a Winnie the Pooh poem as Cookie Monster death metal. Before that, Chris and Elecia chat about mental health, journaling, personal projects, and listener q...

4 Huhti 20251h 6min

497: Everyone Likes Tiny

497: Everyone Likes Tiny

OpenMV has a new Kickstarter so CEO Kwabena Agyeman chatted with us about more powerful (and smaller!) programmable cameras. See OpenMV's site for their existing cameras. See their (already funded!)...

20 Maalis 20251h 24min

496: Beauty, Elegance, Consistency

496: Beauty, Elegance, Consistency

Professor Shimon Schocken spoke with us about teaching computer science from NAND logic gates to arithmetic units, micro assembly, virtual machines, compilers, operating systems, and the Tetris games....

6 Maalis 202559min

495: Shortcut the Difficulties of Reality

495: Shortcut the Difficulties of Reality

Professor Cindy Harnett spoke to us about new and different sensors and actuators, primarily designed for soft robotics and fabricated with relatively low cost materials. Cindy is a professor of elect...

21 Helmi 20251h 1min

494: All Tech Is Wearable

494: All Tech Is Wearable

Debra Ansell joined us to talk about finding friends and exchanging neat gifts, accidentally tricking people into making unmanufacutable boards, and happy, blinking lights. Debra is usually known by t...

7 Helmi 20251h 15min

493: Put the Peeps in the Chili Pot

493: Put the Peeps in the Chili Pot

Elecia and Chris talk with each other about the state of Chris' mind, what makes an embedded developer stand out, "LEGO block" based design, unit tests, and astronomy. Whew! Elecia was recently on the...

24 Tammi 20251h 20min

492: Octopus Army

492: Octopus Army

Nathan Jones chatted with us about his proposal for a computer architecture book based on a 4-bit computer. Nathan found the 4-bit computer in the Hackaday SuperCon 2022 badge and was amazed by some...

27 Joulu 20241h 9min

491: Oscillators Oscillating Other Oscillators

491: Oscillators Oscillating Other Oscillators

Chris and Elecia spoke with Kirk Pearson about running audio-electronic-art workshops, interesting sounds, and their book Make: Electronic Music from Scratch: A Beginner's Guide to Homegrown Audio Gi...

13 Joulu 20241h 6min

Suosittua kategoriassa Tiede

tiedekulma-podcast
rss-mita-tulisi-tietaa
rss-poliisin-mieli
utelias-mieli
rss-duodecim-lehti
rss-metsantuntijat-podcast
mielipaivakirja
rss-luontopodi-samuel-glassar-tutkii-luonnon-ihmeita
docemilia
vinkista-vihia
menologeja-tutkimusmatka-vaihdevuosiin
rss-vaasan-yliopiston-podcastit
rss-duokkari-ekstra
rss-astetta-parempi-elama-podcast
rss-tiedetta-vai-tarinaa
rss-lapsuuden-rakentajat-podcast
rss-miljonaarien-tasavalta