Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the ionos-performance domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /homepages/36/d199566830/htdocs/app199566839/wp-includes/functions.php on line 6114
The Evolution of API – And Then…

The Evolution of API


It is my premise that, despite its monopolistic practices, Microsoft has succeeded by winning the minds of software developers. The Windows API, OLE/COM, the Win32 API, the distributed systems architecture, ODBC, .NET – these are all examples of API provided by Microsoft that have had tremendous impact on the industry. Even as developers decry their dependence on a single vendor, even as they install Eclipse and study Ruby, they can’t deny that it’s simply easier to run Visual Studio and program in C#/.NET.

There are chinks in Microsoft armor. PHP is pretty hard to beat for simple web apps. Microsoft’s share of the mobile device business is pretty small, too, regardless of how cool the Compact Edition of .NET might be. Overall, however, I can think of no other company or technology that has as much influence over developers as Microsoft.

To more clearly demonstrate how Microsoft achieved this hegemony, I thought it might be interesting to review the history of a particular API call and to note Microsoft’s involvement with it. Any programmer that’s read Kernighan and Ritchie’s The C Programming Language, is familiar with the “Hello World” program. (Any programmer that hasn’t read this book should be ashamed of his/herself. This would be akin to an English Lit major not having read any Shakespeare.) Let’s consider how the implementation of “Hello World” (on a PC) has changed over the years.

In 1981, when the first PC became available, the BIOS provided one way of implementing the program:

.data
    Message DB "Hello World"
.ends
.code
    MOV AX,1300h       ; set function code for "Write string", don't move cursor
    XOR  BX,BX         ; write to page 0 with no character attribute
    MOV CX, 11         ; write 11 characters
    PUSH DS
    POP ES
    LEA BP, Message    ; set ES:BP to the address of the message
    INT 10h            ; do it!
.ends

If you didn’t care about screen location or video attributes, MSDOS provided a simpler way:

.data
    Message DB "Hello World"
.ends
.code
    MOV AH,9           ; set function code for "write string at cursor"
    LEA DX, Message    ; set DS:DX to the address of the message (DS is already set)
    INT 21h            ; do it!
.ends

In the early 80’s when high-level languages (other than BASIC) started arriving on the PC, you could do it like K&R:

    int main()
    {
        printf("Hello World");
    }

The arrival of Microsoft Windows in 1985 made life much more complicated. Displaying a label on a dialog box was pretty simple (you could just place it there in the dialog box editor). If you wanted to display text in your application’s client window, that meant you had to write a window procedure and process the WM_PAINT message. Processing this message typically meant deciding on a font to use, figuring out colors to use and dealing with opacity:

    void HandlePaint(HWND hwnd)
    {
        /* Get device context for window */
        HDC hdc = GetDC(hwnd);

        /* Create a font and select it, keeping the old one around */
        HFONT hf = CreateFont(...lots of args...);
        HFONT hfOld = SelectObject(hdc, hf);

        /* Get the client rectangle for the whole window */
        RECT rect;
        GetClientRect(hwnd, &rect);

        /* Draw the text at the top left of the window */
        rect.left = rect.top = 10;
        DrawText(hdc, "Hello World", 11, &rect, DT_SINGLELINE);

        /* Select the old font */
        SelectObject(hdc, hfOld);

        /* delete created resources */
        DeleteObject(hf);
    }

No wonder so many programmers had a hard time moving to Windows! And yet move they did! What were the alternatives? VisiOn was cool but it was a pig. TopView was character-mode only. OS/2 Presentation Manager was Windows run through the IBM bureaucracy filter (e.g. put Win in front of all the API and flip the Y axis top to bottom!). The Mac was equally complicated and less capable (no multitasking, no child windows).

The arrival of 32-bit programming didn’t affect “Hello World” all that much, but it did accomplish two things. First, it freed programmers from having to worry about segmentation (putting code into 64K groups that could be efficiently swapped in and out). Second, it performed better process cleanup meaning that users had to worry less about depleting system resources (as could happen, for example, if you forgot to call DeleteObject in Win16).

OLE/COM affected “Hello World” to the extent that you could now write a “Hello world” application that could be embedded in another one, saved to a single file and printed in composite form. Your code had to worry about garbage collection (maintaining proper reference counts) and implementing appropriate COM interfaces. I’ll not cover this here as I still have scars from those days. Alternatives? None. Corba was still working on PL/1 and Ada support when OLE/COM first shipped. Microsoft was willing to punt on this problem in exchange for 99% market share.

As the final installment, let’s consider “Hello World” in the .NET era. First of all, Winforms programs are very often forms-oriented these days; you might very well choose to implement the program by simply creating a form and dragging a label there in Visual Studio. A Webforms program would do it the same way. If you do need to write a Winforms program that fully handles its client area, you’d write an event handler for a form’s Paint event:

    void Paint(object sender, PaintEventArgs e)
    {
        // get the Graphics object from the event arguments
        Graphics g = e.Graphics;

        // draw our string
        g.DrawString("Hello World", new Font("Arial", 10),
                         Brushes.Black, new Point(10, 10));
    }

If you compare this to the previous version, you can see a lot of similaries. The Graphics object is the equivant of the Windows device context. You still have to create a font. The difference is that C#/.NET has some “syntactic sugar” that makes life easier, for example, simplified arguments when creating fonts and the ability to create objects in-line. Additionally, C#/.NET perform automatic garbage collection so you don’t have to worry about deleting any created objects.

“Hello World” is an extremely simple example that demonstrates how APIs have changed over the course of 27 years. I chose it because, even this simple example, demonstrates how Microsoft has affected developers lives (both positively and negatively). There are better examples (OLE/COM and ODBC/ADO/LinQ) that demonstrate Microsoft’s contributions to the industry but none that can be so easily summarized in an already too long blog!


281 responses to “The Evolution of API”

  1. I simply want to mention I am very new to blogging and certainly enjoyed you’re blog. Likely I’m going to bookmark your site . You surely come with great posts. Thanks a lot for revealing your web-site.

  2. The next time I read a blog, I hope that it doesn’t fail me as much as this particular one. After all, I know it was my choice to read, but I truly thought you’d have something helpful to talk about. All I hear is a bunch of complaining about something you could fix if you weren’t too busy searching for attention.

  3. I was very pleased to discover this page. I want to to thank you for ones time due to this fantastic read!! I definitely enjoyed every little bit of it and I have you bookmarked to see new things on your web site.

  4. Good day! I just want to offer you a big thumbs up for your excellent information you’ve got here on this post. I will be coming back to your web site for more soon.

  5. Hi, I do believe this is a great blog. I stumbledupon it 😉 I will come back yet again since I saved as a favorite it. Money and freedom is the greatest way to change, may you be rich and continue to guide other people.

  6. Aw, this was an exceptionally good post. Taking a few minutes and actual effort to produce a superb article횜 but what can I say횜 I put things off a whole lot and never seem to get nearly anything done.

  7. When I originally commented I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on each time a comment is added I receive four emails with the same comment. Perhaps there is an easy method you can remove me from that service? Appreciate it!

  8. An impressive share! I have just forwarded this onto a coworker who was doing a little homework on this. And he actually bought me lunch due to the fact that I stumbled upon it for him… lol. So allow me to reword this…. Thank YOU for the meal!! But yeah, thanks for spending time to talk about this topic here on your internet site.

  9. Next time I read a blog, Hopefully it does not disappoint me just as much as this one. I mean, I know it was my choice to read through, however I genuinely believed you’d have something useful to talk about. All I hear is a bunch of whining about something you could fix if you weren’t too busy searching for attention.

  10. I’d like to thank you for the efforts you have put in writing this website. I really hope to view the same high-grade content from you later on as well. In fact, your creative writing abilities has motivated me to get my very own website now 😉

  11. Hi! I could have sworn Iíve visited this blog before but after going through some of the posts I realized itís new to me. Nonetheless, Iím definitely delighted I found it and Iíll be bookmarking it and checking back frequently!

  12. Hi there! I could have sworn Iíve been to this blog before but after looking at some of the articles I realized itís new to me. Nonetheless, Iím certainly delighted I stumbled upon it and Iíll be book-marking it and checking back frequently!

  13. Your style is really unique compared to other people I’ve read stuff from. Many thanks for posting when you’ve got the opportunity, Guess I’ll just bookmark this web site.

  14. The very next time I read a blog, I hope that it won’t disappoint me just as much as this one. After all, I know it was my choice to read through, nonetheless I genuinely thought you would probably have something interesting to say. All I hear is a bunch of whining about something that you could fix if you were not too busy seeking attention.

  15. I blog quite often and I genuinely thank you for your information. This great article has truly peaked my interest. I’m going to book mark your blog and keep checking for new details about once a week. I opted in for your RSS feed as well.

  16. Good day! I could have sworn Iíve been to this website before but after going through a few of the articles I realized itís new to me. Anyways, Iím certainly pleased I stumbled upon it and Iíll be book-marking it and checking back often!

  17. Howdy! This post could not be written any better! Looking through this article reminds me of my previous roommate! He always kept talking about this. I’ll forward this article to him. Pretty sure he’ll have a good read. I appreciate you for sharing!

  18. I챠m impressed, I must say. Rarely do I encounter a blog that챠s both equally educative and engaging, and without a doubt, you’ve hit the nail on the head. The problem is an issue that not enough people are speaking intelligently about. I am very happy that I stumbled across this in my search for something relating to this.

  19. I would like to thank you for the efforts you have put in penning this website. I am hoping to see the same high-grade blog posts by you in the future as well. In truth, your creative writing abilities has inspired me to get my very own site now 😉

  20. I’m very pleased to find this page. I wanted to thank you for ones time just for this wonderful read!! I definitely enjoyed every little bit of it and i also have you bookmarked to look at new information on your blog.

  21. An outstanding share! I have just forwarded this onto a friend who has been doing a little homework on this. And he actually ordered me breakfast simply because I found it for him… lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanx for spending time to talk about this topic here on your blog.

  22. I wanted to put you the tiny remark to be able to thank you over again on your pretty suggestions you have provided on this page. It was really strangely open-handed with you to make unhampered precisely what many people would’ve offered for sale for an ebook to get some money for themselves, particularly now that you might have tried it in case you desired. These strategies in addition served to be the good way to know that some people have the identical interest really like my personal own to learn much more when considering this matter. I believe there are several more pleasant sessions in the future for many who read through your site.

  23. I am commenting to let you know of the fantastic encounter my cousin’s daughter experienced reading your site. She even learned many issues, not to mention what it’s like to have a wonderful giving mindset to have many people quite simply grasp chosen grueling subject areas. You really exceeded our expectations. Many thanks for giving the informative, healthy, educational and as well as easy thoughts on the topic to Jane.

  24. My husband and i ended up being comfortable Albert could carry out his analysis because of the ideas he acquired from your site. It’s not at all simplistic just to be giving for free hints that men and women have been making money from. And we all do know we have the website owner to be grateful to because of that. Most of the explanations you’ve made, the easy site menu, the friendships you can assist to engender – it’s everything exceptional, and it’s assisting our son and our family do think that content is cool, and that is extremely important. Many thanks for all the pieces!

  25. My wife and i have been really more than happy when Louis managed to finish off his researching using the precious recommendations he made through your web site. It is now and again perplexing to simply find yourself making a gift of strategies which often some other people may have been trying to sell. Therefore we realize we need the writer to give thanks to for this. The specific illustrations you made, the straightforward web site navigation, the relationships you will help to instill – it is most remarkable, and it is leading our son in addition to us reason why this subject is interesting, which is seriously pressing. Thanks for the whole lot!

  26. This is the perfect web site for anybody who wants to understand this topic. You know a whole lot its almost tough to argue with you (not that I really would want to횜HaHa). You certainly put a brand new spin on a topic that’s been written about for ages. Excellent stuff, just excellent!

  27. Iím amazed, I must say. Rarely do I encounter a blog thatís both educative and engaging, and without a doubt, you have hit the nail on the head. The problem is something which too few men and women are speaking intelligently about. I am very happy I stumbled across this in my search for something relating to this.

  28. Your style is so unique in comparison to other people I have read stuff from. Thank you for posting when you’ve got the opportunity, Guess I’ll just bookmark this web site.

  29. An interesting discussion is worth comment. I do believe that you need to publish more about this subject, it might not be a taboo subject but usually people don’t speak about these issues. To the next! Many thanks!!

  30. Howdy! I simply would like to give you a huge thumbs up for your excellent information you have got right here on this post. I’ll be returning to your web site for more soon.

  31. Hi, I do believe this is an excellent web site. I stumbledupon it 😉 I may revisit yet again since i have saved as a favorite it. Money and freedom is the greatest way to change, may you be rich and continue to guide other people.

  32. I’m excited to discover this page. I need to to thank you for your time just for this fantastic read!! I definitely appreciated every bit of it and I have you bookmarked to look at new stuff in your web site.

  33. I need to to thank you for this great read!! I certainly enjoyed every little bit of it. I’ve got you book marked to look at new stuff you postÖ

  34. After looking into a number of the blog articles on your blog, I really like your way of writing a blog. I added it to my bookmark webpage list and will be checking back soon. Take a look at my web site as well and let me know what you think.

  35. Howdy! I could have sworn Iíve visited this blog before but after looking at a few of the posts I realized itís new to me. Anyhow, Iím certainly happy I found it and Iíll be bookmarking it and checking back regularly!

  36. Greetings from Idaho! I’m bored at work so I decided to browse your site on my iphone
    during lunch break. I really like the knowledge you present here and can’t wait to take a look
    when I get home. I’m surprised at how quick your blog loaded on my phone
    .. I’m not even using WIFI, just 3G .. Anyhow, wonderful site!

  37. I don’t even know how I ended up here, but I thought this
    post was good. I do not know who you are but certainly you are going to a famous blogger
    if you aren’t already 😉 Cheers!

  38. I got this web page from my buddy who informed me concerning
    this site and at the moment this time I am visiting this site and reading very informative posts at this time.

  39. Cool blog! Is your theme custom made or did you download it from somewhere?

    A theme like yours with a few simple tweeks would really make
    my blog stand out. Please let me know where you got your
    design. Thanks

  40. Hello There. I found your blog using msn. This
    is a very well written article. I’ll make sure to bookmark it and come back to read more of
    your useful info. Thanks for the post. I will certainly return.

  41. After exploring a handful of the articles on your web site, I seriously appreciate your way of blogging. I book-marked it to my bookmark website list and will be checking back in the near future. Take a look at my web site as well and let me know your opinion.

  42. Great site you’ve got here.. Itís hard to find quality writing like yours nowadays. I honestly appreciate individuals like you! Take care!!

  43. Hello there! This post could not be written any better! Reading through this article reminds me of my previous roommate! He continually kept preaching about this. I most certainly will forward this article to him. Pretty sure he’ll have a great read. Thanks for sharing!

  44. Hello! I simply wish to offer you a huge thumbs up for the great information you have here on this post. I’ll be coming back to your site for more soon.

  45. Great web site you’ve got here.. It챠s hard to find good quality writing like yours nowadays. I seriously appreciate individuals like you! Take care!!

  46. Hello! I could have sworn Iíve been to your blog before but after browsing through some of the posts I realized itís new to me. Regardless, Iím definitely delighted I found it and Iíll be bookmarking it and checking back often!

  47. My family every time say that I am wasting my time here at web, however I know I
    am getting know-how daily by reading thes fastidious posts.

  48. I must thank you for the efforts you have put in penning this blog. I really hope to see the same high-grade content by you in the future as well. In fact, your creative writing abilities has encouraged me to get my own, personal website now 😉

  49. A fascinating discussion is worth comment. I do believe that you ought to publish more about this topic, it might not be a taboo matter but generally people do not talk about such issues. To the next! Many thanks!!

  50. Iím impressed, I have to admit. Rarely do I encounter a blog thatís both equally educative and amusing, and let me tell you, you’ve hit the nail on the head. The issue is something too few people are speaking intelligently about. I’m very happy I came across this in my hunt for something regarding this.

  51. I blog frequently and I genuinely appreciate your information. Your article has truly peaked my interest. I am going to book mark your website and keep checking for new details about once per week. I subscribed to your RSS feed too.

Leave a Reply

Your email address will not be published. Required fields are marked *