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)

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

484: Collecting My Unhelpful Badge

484: Collecting My Unhelpful Badge

Chris and Elecia talk to each other about setting aside memory in a linker file, printing using your debugger, looking around a new code base, pointers as optimization, choosing processors, skill tree...

5 Syys 20241h 2min

483: An Ion of the Highest Fidelity

483: An Ion of the Highest Fidelity

Rick Altherr spoke with us about high-speed control, complicated systems, and making quantum computers. If you want to know more about building quantum computers, take a listen to Rick's MacroFab epis...

23 Elo 20241h 1min

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