It’s a Blissfully Ignorant World

05 Oct 2020

Admittedly, i struggled with my LSP presentation last week when i wrote it, so i was glad when my brother asked me to go ahead and show just him that one in our late afternoon iteration. While i think for the most part I understood the principle, i did not do a good job of explaining it. I told him that I had a really hard time thinking of examples, fortunately, he actually thought my example was good and very relevant, I just needed some help putting the pieces together.

So with that, the LSP states that one object or class should not have to be cast in order to fit into the calling function. When it comes to chicken & nuggets, casting is kind of like processing. The calling function should not have to process it’s arguments in order to make them suitable, they should come suitable. It would be like buying a pack of frozen nuggets to find a whole chicken inside the package with instructions on how to turn it into nuggets. Rex does not want to turn chicken into nuggets, he wants nuggets to come as nuggets.

Similarly, although my ISP presentation goes back to using my original insect example, the ISP states that Rex doesn’t need to know and thus shouldn’t know that nuggets are subtypes of chicken. Imagine if everytime Rex called his eat(Food food) function where he was given nuggets, and with every nugget he was required to watch a full length video on what chicken was every step it took to becoming a nugget. One, he wouldn’t care and two, he would become very impatient when all he wants is to dip & eat the nugget. Nugget should only inherit the parts of the process that are directly used by the nugget and of course Dippable, which in turn should not have any function within it for items that do not get dipped.

The world of programming is (or should be) a blissfully ignorant world. It’s like going to the grocery store and buying meat where no animals are hurt in the process…. It’s like a facebook or internet where your news feed is only filled with the posts that you need to know about and doesn’t force loads of bs and fake news at you. Of course, when and if the user wants more information, they can call for it.


Rex:
This little man is becoming just that. Today he did chores! Keith told him to take off his shoes and put them in front of the door. He did this to the best of his ability and there is no shame in that he actually put his shoes under the window instead of in front of the door. He got the basic task. Then i told him to take off his socks. He did and threw them on the ground in different directions, so I got a laundry basket and instructed him on what to do with them in the future and enforced his understanding with more clothes that were thrown around the living room. And finally, he helped me bring in all the groceries, and he then instructed Keith to put them into the fridge. Smart little dude.

Leo:
Leo turned 1 on Saturday. He very much enjoyed his smash cake and is officially a chocolate lover. Today, Leo had his 12 month check up, and the kid rocked the world. The day of any stranger who looked at him became brighter as they warmly laughed at his big dimply smile. One nurse who had been waving to him from the doorway as she was calling other patients in, cheered with glee with realization that when she called our name she got to have Leo come back with her.