Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. API

API

Scheduled Pinned Locked Moved The Lounge
jsontutoriallearning
21 Posts 15 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Pete Madden

    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!

    R Offline
    R Offline
    Ravi Bhavnani
    wrote on last edited by
    #8

    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, the dice 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

    N G P E R 5 Replies Last reply
    0
    • R Ravi Bhavnani

      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, the dice 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

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #9

      I'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!

      1 Reply Last reply
      0
      • R Ravi Bhavnani

        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, the dice 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

        G Offline
        G Offline
        Graham Bradshaw
        wrote on last edited by
        #10

        I don't believe a word of this. You mean you actually eat something other than ham? ;P

        R 1 Reply Last reply
        0
        • P Pete Madden

          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!

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #11

          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

          K 1 Reply Last reply
          0
          • G Graham Bradshaw

            I don't believe a word of this. You mean you actually eat something other than ham? ;P

            R Offline
            R Offline
            Ravi Bhavnani
            wrote on last edited by
            #12

            Graham Bradshaw wrote:

            You mean you actually eat something other than ham?

            Of course not! But I have looked at recipes that don't include ham. :) /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

            A 1 Reply Last reply
            0
            • D David Crow

              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

              K Offline
              K Offline
              koothkeeper
              wrote on last edited by
              #13

              Wikipedia might help: http://en.wikipedia.org/wiki/API[^]

              D 1 Reply Last reply
              0
              • K koothkeeper

                Wikipedia might help: http://en.wikipedia.org/wiki/API[^]

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #14

                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

                1 Reply Last reply
                0
                • R Ravi Bhavnani

                  Graham Bradshaw wrote:

                  You mean you actually eat something other than ham?

                  Of course not! But I have looked at recipes that don't include ham. :) /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

                  A Offline
                  A Offline
                  Andy Brummer
                  wrote on last edited by
                  #15

                  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

                  1 Reply Last reply
                  0
                  • P Pete Madden

                    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!

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #16

                    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

                    1 Reply Last reply
                    0
                    • R Ravi Bhavnani

                      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, the dice 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

                      P Offline
                      P Offline
                      Pete Madden
                      wrote on last edited by
                      #17

                      Thanks! ... the analogies will certainly help.

                      1 Reply Last reply
                      0
                      • R Ravi Bhavnani

                        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, the dice 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

                        E Offline
                        E Offline
                        El Corazon
                        wrote on last edited by
                        #18

                        Ravi 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)

                        1 Reply Last reply
                        0
                        • P Pete Madden

                          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!

                          E Offline
                          E Offline
                          El Corazon
                          wrote on last edited by
                          #19

                          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)

                          1 Reply Last reply
                          0
                          • P Pete Madden

                            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!

                            C Offline
                            C Offline
                            code frog 0
                            wrote on last edited by
                            #20

                            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)

                            1 Reply Last reply
                            0
                            • R Ravi Bhavnani

                              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, the dice 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

                              R Offline
                              R Offline
                              Roger Wright
                              wrote on last edited by
                              #21

                              Interesting. 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

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups