[Ilugc] [TIP] C language code to download file using HTTP

  • From: shakthimaan@xxxxxxxxx (Shakthi Kannan)
  • Date: Wed, 16 Nov 2011 08:27:26 +0530

Hi,

--- On Wed, Nov 16, 2011 at 7:54 AM, Girish Venkatachalam
<girishvenkatachalam at gmail.com> wrote:
| int
| dl(char *url)
\--

Answering to your reply on dl() function not being too long. It is not
just that. It is a question of being modular.

Tomorrow, if I want to change the way I connect or download, I only
need to change the function that does that rather than the dl()
function. In fact, one can have multiple functions for different types
of connections, and let the user choose based on options
(static/dynamic). A function must do one job and do it well. This
allows the design to scale, rather than having to maintain multiple
versions of the dl() function.

Write programs that do one thing and do it well ~ Douglas McIlroy

Of course, this is a trivial example for demonstration, but, good
habits start early.

SK

-- 
Shakthi Kannan
http://www.shakthimaan.com

Other related posts: