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)

11: Tell Me I'm Wrong, It's Fine

11: Tell Me I'm Wrong, It's Fine

Karen Lightman (‏@khlightman) joins Elecia White to talk about the infinite awesomeness of tiny MEMS devices. Recorded at the (somewhat noisy but lovely and delicious) Blue Brasserie during SEMICON We...

25 Heinä 20131h 1min

10: Hands Off, Baby

10: Hands Off, Baby

Jen Costillo (@r0b0ts0nf1r3) joins Elecia White to discuss the secret parts of C, keywords that only embedded software engineers seem to know about. They talk about interviewing and why these keywords...

17 Heinä 201358min

9: Kidnapped and Blindfolded

9: Kidnapped and Blindfolded

Randi Eckstein grilled Elecia White (@logicalelegance) on inertial sensors: when to use accelerometers vs. gyroscopes; gyroscopes vs. rate sensors; how to make an inertial measurement unit; the basics...

9 Heinä 20131h 3min

8: Studebaker Love Story

8: Studebaker Love Story

Elecia White is on vacation. Please enjoy some music from the Ballistic Cats!

3 Heinä 201341min

7: Lights, Camera, Electrons

7: Lights, Camera, Electrons

Josh Chan and Tarun Pondicherry, founders of Light Up, join Elecia White to talk about how to teach electronics to elementary and middle school students. The Light Up Kickstarter ends on June 30, 2013...

26 Kesä 20131h 6min

6: Do Robot Squirrels Dream of Electric Imps...

6: Do Robot Squirrels Dream of Electric Imps...

Matt Haines (@BeardedInventor) of Electric Imp joins Elecia White to discuss how to connect cats (and other things) to the Internet. Buy an Imp on Adafruit but don't forget the adapter (aka April boar...

20 Kesä 201348min

5: Passion Is Contagious

5: Passion Is Contagious

Akkana Peck (@akkakk) joins Elecia White to talk about an introduction to Arduino workshop for high school students. Arduino boards are a fantastic way to encourage people into embedded systems. The b...

13 Kesä 20131h

4: Are We Not Lawyers?

4: Are We Not Lawyers?

Elecia and Chris (@stoneymonster) discuss why they chose to go into consulting and what they've learned while building Logical Elegance into the company it is. SCORE is a great resource for small busi...

6 Kesä 20131h 13min

Suosittua kategoriassa Tiede

rss-mita-tulisi-tietaa
rss-poliisin-mieli
tiedekulma-podcast
rss-lihavuudesta-podcast
utelias-mieli
koodikahvit
docemilia
radio-antro
rss-ranskaa-raakana
rss-duodecim-lehti
rss-metsantuntijat-podcast
rss-tervetta-skeptisyytta
hippokrateen-vastaanotolla
mielipaivakirja
filocast-filosofian-perusteet
rss-duokkari-ekstra
rss-astetta-parempi-elama-podcast
rss-miljonaarien-tasavalta