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

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

490: Wait Until Physics Has Happened

490: Wait Until Physics Has Happened

Nikolaus Correll spoke with us about robots, teaching robotics, and writing books about robots. Nikolaus is a Professor of Computer Science at the University of Colorado, see his lab website (or his ...

28 Marras 20241h 5min

489: Constructive Cat

489: Constructive Cat

Chris and Elecia discuss her origami art show, ponder PRs for solo developers, attempt to explain GDB debugging, and make a to-do list for getting rid of Kanga. Elecia is having an Origami Octopus Ga...

16 Marras 20241h 1min

488: Two Slices of Complimentary Bread

488: Two Slices of Complimentary Bread

Adrienne Braganza Tacke spoke with us about her book Looks Good To Me: Constructive Code Reviews. It is about how to make code reviews more useful, effective, and congenial. Adrienne's book is availa...

31 Loka 20241h 10min

487: Focus on Fizzing

487: Focus on Fizzing

Chris and Elecia chat about simulated robots, portents in the sky, the futility of making plans, and grad school. A problem with mics led us to delay the show with Shimon Schoken from Nand2Tetris (co...

17 Loka 20241h 5min

486: A Nice Rainbow Dream

486: A Nice Rainbow Dream

Antoine van Gelder spoke to us about making digital musical instruments, USB, and FPGAs. Antoine works for Great Scott Gadgets, specifically on the Cynthion USB protocol analysis tool that can be use...

3 Loka 202454min

485: Conversation Is a Kind of Music

485: Conversation Is a Kind of Music

Alan Blackwell spoke with us about the lurking dangers of large language models, the magical nature of artificial intelligence, and the future of interacting with computers. Alan is the author of Mo...

20 Syys 20241h 17min

Suosittua kategoriassa Tiede

rss-mita-tulisi-tietaa
rss-poliisin-mieli
tiedekulma-podcast
utelias-mieli
docemilia
radio-antro
filocast-filosofian-perusteet
rss-ranskaa-raakana
rss-duodecim-lehti
rss-astetta-parempi-elama-podcast
rss-tervetta-skeptisyytta
rss-lihavuudesta-podcast
university-of-eastern-finland
vinkista-vihia
mielipaivakirja
rss-duokkari-ekstra
rss-paanavauksia
rss-metsantuntijat-podcast
rss-miljonaarien-tasavalta