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)

Tämä jakso on lisätty Podme-palveluun avoimen RSS-syötteen kautta eikä se ole Podmen omaa tuotantoa. Siksi jakso saattaa sisältää mainontaa.

Jaksot(580)

533: The Garage Is Open

533: The Garage Is Open

Author Susan Lammers joins the show to discuss the 40th anniversary edition of her classic book, Programmers at Work. We discuss what it was like to interview young and pioneering software developers ...

4 Syys 59min

532: It's Still Real Fire

532: It's Still Real Fire

Kevin Santo Cappuccio, founder of Architeuthis Flux, joins the show to discuss creating Jumperless, an open-source breadboard that replaces physical jumper wires with software-controlled analog crossb...

20 Elo 1h 9min

531: Sequestering the Mess

531: Sequestering the Mess

Elecia and Christopher celebrate winning the IEEE Educational Activities Board Meritorious Achievement Award in Outreach and Informal Education! A huge thank you to Mark Omo and the wonderful listener...

6 Elo 1h 7min

530: A Living Highlighter

530: A Living Highlighter

Marine biologist Dr. Steven Haddock joins the show to share the alien, glowing, and transparent wonders of the deep ocean. We discuss his beautiful new book, The Radiant Sea, and explore the complex e...

25 Heinä 1h 8min

529: The Narwhal Looked Amazing

529: The Narwhal Looked Amazing

Chris Svec returns to the show to discuss the messy, non-linear realities of engineering management and onboarding new college graduates. We explore why companies should bother hiring fresh grads in t...

9 Heinä 1h 22min

528: Goldfish Chunks

528: Goldfish Chunks

Tyler Hoffman returns to the show to discuss diagnostics and observability data in embedded systems. We catch up on his life after startup acquisition, explore the hows and whys of keeping product dat...

25 Kesä 1h 10min

527: At The Jellyfish Conference

527: At The Jellyfish Conference

Chris and Elecia talk about pushing out of their comfort zone, networking advice, adding STARs and action verbs to resumes, using rust, thermo forming plastics, soldering together audio gear, and winn...

12 Kesä 1h 9min

526: Take A Taste Of Engineers

526: Take A Taste Of Engineers

Dr. Victoria Serrano spoke with us about STEM outreach, fostering curiosity, and inspiring students with engineering education. Victoria is a professor at the Technological University of Panama (her ...

28 Touko 1h 1min

Suosittua kategoriassa Tiede

tiedekulma-podcast
rss-mita-tulisi-tietaa
rss-poliisin-mieli
utelias-mieli
rss-duodecim-lehti
rss-ruoka-murroksessa
hippokrateen-vastaanotolla
rss-totuuden-liepeilla
rss-mika-kestaa
rss-tervetta-skeptisyytta
rss-hereilla
rss-kasvikutsut
rss-luontopodi-samuel-glassar-tutkii-luonnon-ihmeita
mielipaivakirja
filocast-filosofian-perusteet
rss-lihavuudesta-podcast
rss-sosiopodi