API
-
My sister is getting into her first programming course and she has a tough time understanding the concept of "API". I have tried explaining it to her in different ways but failed to convey the message. Any ideas/simple examples on how to get her to understand would be great ... thanks!
When I taught CS (20+ yrs ago :)), I likened an API to a "name for a series of actions", for example
turnOnTheStove()
. In the world of cooking, thedice
API takes a parameter (eg:potato
) and returns something (diced potatotes
). Obviously you can't dice an oak tree, so the "type" of the parameter is important (eg:Vegetable
). As you get deeper, you could genericize the type to an interface (eg:IDiceable
), which would include vegetables and certain meats. A library of APIs is nothing but a cookbook. Just as you reference a cookbook on Indian cooking to follow a recipe for Chicken Vindaloo, you could use a specific library (eg:gdi32.dll
) to perform graphics related actions. I find there's a strong correlation between a creative activity like cooking and software engineering. It helps to find analogies in the culinary space as they are readily understood by most people. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com -
When I taught CS (20+ yrs ago :)), I likened an API to a "name for a series of actions", for example
turnOnTheStove()
. In the world of cooking, thedice
API takes a parameter (eg:potato
) and returns something (diced potatotes
). Obviously you can't dice an oak tree, so the "type" of the parameter is important (eg:Vegetable
). As you get deeper, you could genericize the type to an interface (eg:IDiceable
), which would include vegetables and certain meats. A library of APIs is nothing but a cookbook. Just as you reference a cookbook on Indian cooking to follow a recipe for Chicken Vindaloo, you could use a specific library (eg:gdi32.dll
) to perform graphics related actions. I find there's a strong correlation between a creative activity like cooking and software engineering. It helps to find analogies in the culinary space as they are readily understood by most people. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)comI've always felt that cooking recipes are like specialized algorithms. So your example/explanation really appeals to me, Ravi :-) Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
The Ultimate Grid - The #1 MFC grid out there! -
When I taught CS (20+ yrs ago :)), I likened an API to a "name for a series of actions", for example
turnOnTheStove()
. In the world of cooking, thedice
API takes a parameter (eg:potato
) and returns something (diced potatotes
). Obviously you can't dice an oak tree, so the "type" of the parameter is important (eg:Vegetable
). As you get deeper, you could genericize the type to an interface (eg:IDiceable
), which would include vegetables and certain meats. A library of APIs is nothing but a cookbook. Just as you reference a cookbook on Indian cooking to follow a recipe for Chicken Vindaloo, you could use a specific library (eg:gdi32.dll
) to perform graphics related actions. I find there's a strong correlation between a creative activity like cooking and software engineering. It helps to find analogies in the culinary space as they are readily understood by most people. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)comI don't believe a word of this. You mean you actually eat something other than ham? ;P
-
My sister is getting into her first programming course and she has a tough time understanding the concept of "API". I have tried explaining it to her in different ways but failed to convey the message. Any ideas/simple examples on how to get her to understand would be great ... thanks!
Pete Madden wrote:
Any ideas/simple examples on how to get her to understand would be great ... thanks!
In what ways have you tried, and failed?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
I don't believe a word of this. You mean you actually eat something other than ham? ;P
-
Pete Madden wrote:
Any ideas/simple examples on how to get her to understand would be great ... thanks!
In what ways have you tried, and failed?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
Wikipedia might help: http://en.wikipedia.org/wiki/API[^]
-
Wikipedia might help: http://en.wikipedia.org/wiki/API[^]
Perhaps, assuming that I was the one needing help.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
Is that just to make the ham jealous or are you really thinking about straying?
Using the GridView is like trying to explain to someone else how to move a third person's hands in order to tie your shoelaces for you. -Chris Maunder
-
My sister is getting into her first programming course and she has a tough time understanding the concept of "API". I have tried explaining it to her in different ways but failed to convey the message. Any ideas/simple examples on how to get her to understand would be great ... thanks!
The I is for interface - it is how you interface to someone else's code without having to know all about the insides. The tigress is here :-D
-
When I taught CS (20+ yrs ago :)), I likened an API to a "name for a series of actions", for example
turnOnTheStove()
. In the world of cooking, thedice
API takes a parameter (eg:potato
) and returns something (diced potatotes
). Obviously you can't dice an oak tree, so the "type" of the parameter is important (eg:Vegetable
). As you get deeper, you could genericize the type to an interface (eg:IDiceable
), which would include vegetables and certain meats. A library of APIs is nothing but a cookbook. Just as you reference a cookbook on Indian cooking to follow a recipe for Chicken Vindaloo, you could use a specific library (eg:gdi32.dll
) to perform graphics related actions. I find there's a strong correlation between a creative activity like cooking and software engineering. It helps to find analogies in the culinary space as they are readily understood by most people. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)comThanks! ... the analogies will certainly help.
-
When I taught CS (20+ yrs ago :)), I likened an API to a "name for a series of actions", for example
turnOnTheStove()
. In the world of cooking, thedice
API takes a parameter (eg:potato
) and returns something (diced potatotes
). Obviously you can't dice an oak tree, so the "type" of the parameter is important (eg:Vegetable
). As you get deeper, you could genericize the type to an interface (eg:IDiceable
), which would include vegetables and certain meats. A library of APIs is nothing but a cookbook. Just as you reference a cookbook on Indian cooking to follow a recipe for Chicken Vindaloo, you could use a specific library (eg:gdi32.dll
) to perform graphics related actions. I find there's a strong correlation between a creative activity like cooking and software engineering. It helps to find analogies in the culinary space as they are readily understood by most people. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)comRavi Bhavnani wrote:
A library of APIs is nothing but a cookbook. Just as you reference a cookbook on Indian cooking to follow a recipe for Chicken Vindaloo, you could use a specific library (eg: gdi32.dll) to perform graphics related actions.
This is what I use for explanations, cooking, household tasks, or ordering a meal. Make_Lasagna() is the API, with the individual tasks of heating noodles, mixing cheeses, preparing sauces, all hidden. You know they have to be done, and they do get done, but you aren't thinking of making noodle, tomato sauce, cheese bake, you are thinking Lasagna. You are building an API without realizing it. Now when you order it, you are now at the highest level, using the API without having to conduct the individual tasks, again you do not ask for a noodle, tomato sauce, cheese bake, you ask for "Make mine Lasagna" and the cook takes your API call and runs the operation and gives you back lasagna. You didn't have to tell him how to make the Lasagna, he took your request and just "did it". Of course, just like in programming, some APIs do near the same thing, just as no two Italian restraunts make Lasagna quite the same way. _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
My sister is getting into her first programming course and she has a tough time understanding the concept of "API". I have tried explaining it to her in different ways but failed to convey the message. Any ideas/simple examples on how to get her to understand would be great ... thanks!
Pete Madden wrote:
I have tried explaining it to her in different ways but failed to convey the message.
Tell her to spend one day actually explaining everything she does. Instead of "brushing teeth" describe the entire process in horrible detail. Walking, describe the process of picking up feet bending knees, swinging leg forward, possible slight body rotation, swinging arms, etc. You don't think of all that, because you are thinking on the higher level, "walking" is a higher level product, an API that handles all that lower level stuff. If she spends one day, thinking about what "going to work" actually entails in horrible detail, what steps it takes to listen to music (on select artist, or album, play, put on headphones or turn up volume). If she leaves out any little thing, she is still dealing with a higher level API call. Bugs are introduced because in your description of hte API for cooking you forgot to put in salt, because it seemed "so obvious" that it was easy to leave out. In describing the process of going to school, did you remember to open the car door, exit the car, close the door and lock it? these things are taken for granted, and as in programming it is those small tasks in the API that create the most bugs. They seemed so obvious it was easy to overlook. :) _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
My sister is getting into her first programming course and she has a tough time understanding the concept of "API". I have tried explaining it to her in different ways but failed to convey the message. Any ideas/simple examples on how to get her to understand would be great ... thanks!
I haven't seen it yet but an API is like a construction supply wharehouse. You need an 8' 2x4 stud. You don't know how it got to be that you just need it. You need a 5# nail. You don't care how it got to be a nail you just need one. Construction is the best metaphor for software and especially API's. There's 100 different types, sizes, weights of woods, nails, screws etc... You don't know if they are planed by hand or machine or how they came to be. You simply invoke the GetPlywood("1/2", "4", "8", 30); //You want 1/2" plywood in 4' by 8' sections and you need 30 sections. - Rex
The enemy's gate is down. :cool: Welcome to CP in your language. Post the unicode version in My CP Blog[^] now. People who don't understand how awesome Firefox is have never used CPhog. The act of using CPhog alone doesn't make Firefox cool. It opens your eyes to the possibilities and then you start looking for other things like CPhog and your eyes are suddenly open to all sorts of useful things all through Firefox. - (Self Quote)
-
When I taught CS (20+ yrs ago :)), I likened an API to a "name for a series of actions", for example
turnOnTheStove()
. In the world of cooking, thedice
API takes a parameter (eg:potato
) and returns something (diced potatotes
). Obviously you can't dice an oak tree, so the "type" of the parameter is important (eg:Vegetable
). As you get deeper, you could genericize the type to an interface (eg:IDiceable
), which would include vegetables and certain meats. A library of APIs is nothing but a cookbook. Just as you reference a cookbook on Indian cooking to follow a recipe for Chicken Vindaloo, you could use a specific library (eg:gdi32.dll
) to perform graphics related actions. I find there's a strong correlation between a creative activity like cooking and software engineering. It helps to find analogies in the culinary space as they are readily understood by most people. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)comInteresting. I find in teaching that many people say that they can't do algebra. I use the recipe analogy to illustrate using equations with great success. For example, A Yorkshire Pudding takes 1 cup of flour, one cup of milk, 1 tsp of salt, and two eggs to make 6 servings. How many eggs do I need to make 12 servings? Nearly everyone can figure that out, then I represent it in equation form and show them that they've been doing algebra all along, just didn't know what to call it. A good analogy is worth a dozen teachers.:-D "...a photo album is like Life, but flat and stuck to pages." - Shog9