What are some programs every programmer should make at least once?

Question
Mudassir Ali 9 months 1 Answer 121 views

Answer ( 1 )

  1. A web server.

    I did this one Saturday morning nearly 20 years ago in Java when I was getting more familiar with Unix and TCP/IP and discovered that Java had classes for socket programming. It stands out in my mind as the single most enlightening few hours worth of programming I ever did.

    Now, it was rather simple. But it included the basic ability to listen on a socket, parse an HTTP request to get the verb and the path, and send back a response. Initially that was a static “Hello” or something like that, and then it was a file as specified by the path.

    I then threw something like 10 simultaneous requests at it and promptly crashed it. So then I tweaked it a bit with multiple threads. Then threw more of a load at it, crashed it again. So started thinking about caching, managing memory usage while reading in the file contents and preparing the response etc.

    I learned so much that morning – it was like lifting the lid on the Internet and going “ahhhh! so that’s how it all works!”

    (bonus points for writing a load generator to help you crash said web server… 🙂 )

Leave an answer