diff options
| author | Kumar Damani <me@kumardamani.net> | 2023-01-03 18:13:10 +0000 |
|---|---|---|
| committer | Kumar Damani <me@kumardamani.net> | 2023-01-03 18:13:10 +0000 |
| commit | 610d1f02dd57cbaeccd076ad14ee9efacc5954a5 (patch) | |
| tree | 0ecd1cb8080cc794840a4f88fcc471eb317df0d8 | |
| parent | 8a1af05eeb23fde8dfcde4340a3826598379e7cd (diff) | |
prog as art post draft
| -rw-r--r-- | content/post/programming-as-art/index.md | 67 | ||||
| -rw-r--r-- | public/categories/index.html | 2 | ||||
| -rw-r--r-- | public/index.html | 4 | ||||
| -rw-r--r-- | public/index.xml | 11 | ||||
| -rw-r--r-- | public/post/index.html | 16 | ||||
| -rw-r--r-- | public/post/index.xml | 11 | ||||
| -rw-r--r-- | public/post/programming-as-art/index.html | 106 | ||||
| -rw-r--r-- | public/post/programs/index.html | 2 | ||||
| -rw-r--r-- | public/post/self-host/index.html | 4 | ||||
| -rw-r--r-- | public/series/index.html | 2 | ||||
| -rw-r--r-- | public/sitemap.xml | 13 | ||||
| -rw-r--r-- | public/tags/index.html | 2 | ||||
| -rw-r--r-- | public/tags/index.xml | 6 | ||||
| -rw-r--r-- | public/tags/index/index.html | 2 | ||||
| -rw-r--r-- | public/tags/index/index.xml | 2 | ||||
| -rw-r--r-- | public/tags/personal/index.html | 5 | ||||
| -rw-r--r-- | public/tags/personal/index.xml | 11 | ||||
| -rw-r--r-- | public/tags/tech/index.html | 5 | ||||
| -rw-r--r-- | public/tags/tech/index.xml | 11 |
19 files changed, 257 insertions, 25 deletions
diff --git a/content/post/programming-as-art/index.md b/content/post/programming-as-art/index.md new file mode 100644 index 0000000..1be9cb5 --- /dev/null +++ b/content/post/programming-as-art/index.md @@ -0,0 +1,67 @@ ++++ +author = "Kumar Damani" +title = "Romanticism in Programming" +date = "2022-11-29" +draft = true +description = "How programming is romantic." +tags = [ + "personal" +] ++++ + +Why there is art in programming. +<!--more--> + +During the early days as a CS student we were learning about loops, +and saw "Hello World!" getting printed out to the console N-thousands of times +in just 3 functional lines of code. + +for 1 to 1000: + print "Hello World!" + +This felt like having the Elder Wand at the time. + +But there was more to our lesson. +The TA then asks us to put our newly found power to use by computing the +sum of 1 to 100. Of course, it was a natural application of our topic: + +sum = 0 +for i in 1 to 100: + sum = sum + i + +Sure enough we saw the answer 5050 in the console. +But then the TA reminds us that we are making our computers work too hard. +It needs to do 100 basic ADD instructions in order to make this computation happen. + +What if it the number was a million? How well would our method scale? +Well then it would take a million basic ADD instructions. +Seems like this scales with "linearly" with the input size. +Later we would formalize this to O(n). + +The TA hinted that there is a better way, and that we already know of the better way in math. + +sum = n(n+1)/2 + +With this we are no longer using loops, but a known mathematical fact about sequences. +This one-liner solves our problem with 3 basic (ADD, MULTIPLY, DIVIDE) instructions. +It does not depend on the size of the input like our previous solution, thus +no matter the input, it always takes 3 instructions to compute! +This is a HUGE win! +Later we would formalize this to O(1), or "constant" scaling. + +> IRL the complier would optimize the loop solution such that it does not take N instructions +but for the purposes of learning we were not allowed to depend on that. + +Looking back at it now, +Both solutions are equally correct, and modern compilers would optimize the first solution +in the final instructions such that any performance differences would be negligible. +Objectively, the first solution is more readable, and friendly to a new observer than the second. +Yet I am still so drawn to the second solution. + +The first solution reminds me of the saying "to a hammer, eveything looks like a nail". +Its a brute force approach. +In comparison, with the second solution, using the exact tool for our particular problem +somehow feels personalized and even "romantic". + +Most often in programming, we don't have such clear optimizations. It often comes down to +using the correct data-structures for the correct situation, and elegance emerges as a result. diff --git a/public/categories/index.html b/public/categories/index.html index 3c25e13..b07f4d4 100644 --- a/public/categories/index.html +++ b/public/categories/index.html @@ -79,7 +79,7 @@ </section> <footer class="page__footer"><p class="copyright"></p> - +<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p> </footer> </div> diff --git a/public/index.html b/public/index.html index 6d00e1f..47501c0 100644 --- a/public/index.html +++ b/public/index.html @@ -2,7 +2,7 @@ <html lang="en"> <head> - <meta name="generator" content="Hugo 0.101.0" /><title>Kumar Damani - Home</title> + <meta name="generator" content="Hugo 0.105.0"><title>Kumar Damani - Home</title> <meta name="description" content="Git, email, resume etc."> <meta name="viewport" content="width=device-width, initial-scale=1"> @@ -244,7 +244,7 @@ years in between semesters. </section> <footer class="page__footer"><p class="copyright"></p> - +<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p> </footer> </div> diff --git a/public/index.xml b/public/index.xml index a0e494d..c474b88 100644 --- a/public/index.xml +++ b/public/index.xml @@ -6,7 +6,16 @@ <description>Recent content on Kumar Damani - Home</description> <generator>Hugo -- gohugo.io</generator> <language>en-us</language> - <lastBuildDate>Mon, 12 Sep 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://kumardamani.net/index.xml" rel="self" type="application/rss+xml" /> + <lastBuildDate>Tue, 29 Nov 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://kumardamani.net/index.xml" rel="self" type="application/rss+xml" /> + <item> + <title>Romanticism in Programming</title> + <link>https://kumardamani.net/post/programming-as-art/</link> + <pubDate>Tue, 29 Nov 2022 00:00:00 +0000</pubDate> + + <guid>https://kumardamani.net/post/programming-as-art/</guid> + <description><p>Why programming I see programming as an art form.</p></description> + </item> + <item> <title>Why do I self-host?</title> <link>https://kumardamani.net/post/self-host/</link> diff --git a/public/post/index.html b/public/post/index.html index 524f518..12a4c71 100644 --- a/public/post/index.html +++ b/public/post/index.html @@ -45,6 +45,20 @@ <article class="post"> <header class="post__header"> + <h1><a href="https://kumardamani.net/post/programming-as-art/">Romanticism in Programming</a></h1> + <p class="post__meta"> + Kumar Damani, + <span class="date">29 November 2022</span> + </p> + </header> + + <section class="post__summary"> + <p>Why programming I see programming as an art form.</p> + </section> + </article> + + <article class="post"> + <header class="post__header"> <h1><a href="https://kumardamani.net/post/self-host/">Why do I self-host?</a></h1> <p class="post__meta"> Kumar Damani, @@ -105,7 +119,7 @@ </section> <footer class="page__footer"><p class="copyright"></p> - +<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p> </footer> </div> diff --git a/public/post/index.xml b/public/post/index.xml index 8451bdc..117b024 100644 --- a/public/post/index.xml +++ b/public/post/index.xml @@ -6,7 +6,16 @@ <description>Recent content in Posts on Kumar Damani - Home</description> <generator>Hugo -- gohugo.io</generator> <language>en-us</language> - <lastBuildDate>Mon, 12 Sep 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://kumardamani.net/post/index.xml" rel="self" type="application/rss+xml" /> + <lastBuildDate>Tue, 29 Nov 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://kumardamani.net/post/index.xml" rel="self" type="application/rss+xml" /> + <item> + <title>Romanticism in Programming</title> + <link>https://kumardamani.net/post/programming-as-art/</link> + <pubDate>Tue, 29 Nov 2022 00:00:00 +0000</pubDate> + + <guid>https://kumardamani.net/post/programming-as-art/</guid> + <description><p>Why programming I see programming as an art form.</p></description> + </item> + <item> <title>Why do I self-host?</title> <link>https://kumardamani.net/post/self-host/</link> diff --git a/public/post/programming-as-art/index.html b/public/post/programming-as-art/index.html new file mode 100644 index 0000000..691abf4 --- /dev/null +++ b/public/post/programming-as-art/index.html @@ -0,0 +1,106 @@ +<!DOCTYPE html> +<html lang="en"> + + <head><title>Romanticism in Programming – Kumar Damani - Home</title> +<meta name="description" content="Git, email, resume etc."> + +<meta name="viewport" content="width=device-width, initial-scale=1"> +<meta charset="utf-8"/> + + + +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.2/css/all.min.css" integrity="sha512-1sCRPdkRXhBV2PBLUdRb4tMg1w2YPf37qatUFeS7zlBy7jJI8Lf4VHwWfZZfpXtYSLy85pkm9GaYVYMfw5BC1A==" crossorigin="anonymous" /> + + +<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/academicons/1.9.1/css/academicons.min.css" integrity="sha512-b1ASx0WHgVFL5ZQhTgiPWX+68KjS38Jk87jg7pe+qC7q9YkEtFq0z7xCglv7qGIs/68d3mAp+StfC8WKC5SSAg==" crossorigin="anonymous" /> + + +<link rel="stylesheet" href="https://kumardamani.net/css/colour/gruvbox-dark.css"> +<link rel="stylesheet" href="https://kumardamani.net/css/colour/dark-mode.css"> +<link rel="stylesheet" href="https://kumardamani.net/css/risotto.css"> +<link rel="stylesheet" href="https://kumardamani.net/css/custom.css"> +</head> + + <body> + <div class="page"> + + <header class="page__header"><h1 class="page__logo"><a href="https://kumardamani.net/" class="page__logo-inner">Kumar Damani - Home</a></h1> +<nav class="page__nav main-nav"> + <ul> + + + <li class="main-nav__item"><a class="nav-main-item active" href="/post/" title="Posts">Posts</a></li> + + </ul> +</nav> + +</header> + + <section class="page__body"> + <header class="content__header"> + <h1>Romanticism in Programming</h1> + </header> + <div class="content__body"> + <p>Why programming I see programming as an art form.</p> +<p>It started off in my first year as a CS student during a lecture about loops. +It was mind-bending to see “Hello World!” getting printed out to the console N-thousands of times +in just 3 functional lines of code.</p> +<p>But there was more. The TA then asks us to put our newly found power to use by producing the +sum of 1 to 100. Ofcourse, it was a natural application of our topic. We simply set the limit, +and do an increment a sum in the loop’s body.</p> +<p>Sure enough we saw the answer 5050 in the console. +But then the TA reminds us that we are making that computer work too hard. +It needs to do 100 basic ADD instructions in order to make this happen. +What if it was a million? +Is there a better way?</p> + </div> + <footer class="content__footer"></footer> + + </section> + + <section class="page__aside"> + <div class="aside__about"> +<div class="aside__about"> + <img class="about__logo" src="https://kumardamani.net/images/rice.svg" alt="Logo"> +<h1 class="about__title">Links</h1> +<p class="about__description">Git, email, resume etc.</p> +</div> + + +<ul class="aside__social-links"> + + <li> + <a href="https://gitlab.com/kdam0/" rel="me" aria-label="GitLab" title="GitLab"><i class="fa-brands fa-gitlab" aria-hidden="true"></i></a> + </li> + + <li> + <a href="mailto:me@kumardamani.net" rel="me" aria-label="Email" title="Email"><i class="fa-solid fa-envelope" aria-hidden="true"></i></a> + </li> + + <li> + <a href="/KumarDamaniCV.pdf" rel="me" aria-label="Resume" title="Resume"><i class="fa-solid fa-file" aria-hidden="true"></i></a> + </li> + +</ul> +</div> + <hr> + <div class="aside__content"> + <p>Why I see programming as an art form.</p> + + <p> + By Kumar Damani, + 2022-11-29 + </p> + + + </div> + </section> + + <footer class="page__footer"><p class="copyright"></p> +<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p> +</footer> + + </div> + </body> + +</html> diff --git a/public/post/programs/index.html b/public/post/programs/index.html index fb13c1a..8d27d54 100644 --- a/public/post/programs/index.html +++ b/public/post/programs/index.html @@ -142,7 +142,7 @@ suffice it to say I will not endorse the usage of proprietary software.</p> </section> <footer class="page__footer"><p class="copyright"></p> - +<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p> </footer> </div> diff --git a/public/post/self-host/index.html b/public/post/self-host/index.html index 723ce2f..cdc2049 100644 --- a/public/post/self-host/index.html +++ b/public/post/self-host/index.html @@ -161,7 +161,7 @@ Short of this, you can only limit your usage.</li> <hr> <ol> <li id="fn:1"> -<p><a href="https://sitn.hms.harvard.edu/flash/2018/dopamine-smartphones-battle-time/">Smartphones and dompanime</a> <a href="#fnref:1" class="footnote-backref" role="doc-backlink">↩︎</a></p> +<p><a href="https://sitn.hms.harvard.edu/flash/2018/dopamine-smartphones-battle-time/">Smartphones and dopamine</a> <a href="#fnref:1" class="footnote-backref" role="doc-backlink">↩︎</a></p> </li> <li id="fn:2"> <p><a href="https://onlinedegrees.unr.edu/online-master-of-public-health/impact-of-social-media-on-youth-mental-health/">Mental health and social media</a> <a href="#fnref:2" class="footnote-backref" role="doc-backlink">↩︎</a></p> @@ -215,7 +215,7 @@ Short of this, you can only limit your usage.</li> </section> <footer class="page__footer"><p class="copyright"></p> - +<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p> </footer> </div> diff --git a/public/series/index.html b/public/series/index.html index f1b97df..1dd6c3d 100644 --- a/public/series/index.html +++ b/public/series/index.html @@ -79,7 +79,7 @@ </section> <footer class="page__footer"><p class="copyright"></p> - +<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p> </footer> </div> diff --git a/public/sitemap.xml b/public/sitemap.xml index 8ff01db..a034c96 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -3,20 +3,23 @@ xmlns:xhtml="http://www.w3.org/1999/xhtml"> <url> <loc>https://kumardamani.net/</loc> - <lastmod>2022-09-12T00:00:00+00:00</lastmod> + <lastmod>2022-11-29T00:00:00+00:00</lastmod> <priority>0</priority> </url><url> <loc>https://kumardamani.net/tags/personal/</loc> - <lastmod>2022-09-12T00:00:00+00:00</lastmod> + <lastmod>2022-11-29T00:00:00+00:00</lastmod> </url><url> <loc>https://kumardamani.net/post/</loc> - <lastmod>2022-09-12T00:00:00+00:00</lastmod> + <lastmod>2022-11-29T00:00:00+00:00</lastmod> + </url><url> + <loc>https://kumardamani.net/post/programming-as-art/</loc> + <lastmod>2022-11-29T00:00:00+00:00</lastmod> </url><url> <loc>https://kumardamani.net/tags/</loc> - <lastmod>2022-09-12T00:00:00+00:00</lastmod> + <lastmod>2022-11-29T00:00:00+00:00</lastmod> </url><url> <loc>https://kumardamani.net/tags/tech/</loc> - <lastmod>2022-09-12T00:00:00+00:00</lastmod> + <lastmod>2022-11-29T00:00:00+00:00</lastmod> </url><url> <loc>https://kumardamani.net/post/self-host/</loc> <lastmod>2022-09-12T00:00:00+00:00</lastmod> diff --git a/public/tags/index.html b/public/tags/index.html index 66b6307..ed7f494 100644 --- a/public/tags/index.html +++ b/public/tags/index.html @@ -88,7 +88,7 @@ </section> <footer class="page__footer"><p class="copyright"></p> - +<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p> </footer> </div> diff --git a/public/tags/index.xml b/public/tags/index.xml index 57f2072..e50ba59 100644 --- a/public/tags/index.xml +++ b/public/tags/index.xml @@ -6,11 +6,11 @@ <description>Recent content in Tags on Kumar Damani - Home</description> <generator>Hugo -- gohugo.io</generator> <language>en-us</language> - <lastBuildDate>Mon, 12 Sep 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://kumardamani.net/tags/index.xml" rel="self" type="application/rss+xml" /> + <lastBuildDate>Tue, 29 Nov 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://kumardamani.net/tags/index.xml" rel="self" type="application/rss+xml" /> <item> <title>personal</title> <link>https://kumardamani.net/tags/personal/</link> - <pubDate>Mon, 12 Sep 2022 00:00:00 +0000</pubDate> + <pubDate>Tue, 29 Nov 2022 00:00:00 +0000</pubDate> <guid>https://kumardamani.net/tags/personal/</guid> <description></description> @@ -19,7 +19,7 @@ <item> <title>tech</title> <link>https://kumardamani.net/tags/tech/</link> - <pubDate>Mon, 12 Sep 2022 00:00:00 +0000</pubDate> + <pubDate>Tue, 29 Nov 2022 00:00:00 +0000</pubDate> <guid>https://kumardamani.net/tags/tech/</guid> <description></description> diff --git a/public/tags/index/index.html b/public/tags/index/index.html index 92ab33d..5557e2f 100644 --- a/public/tags/index/index.html +++ b/public/tags/index/index.html @@ -82,7 +82,7 @@ </section> <footer class="page__footer"><p class="copyright"></p> - +<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p> </footer> </div> diff --git a/public/tags/index/index.xml b/public/tags/index/index.xml index 56bc695..78403f7 100644 --- a/public/tags/index/index.xml +++ b/public/tags/index/index.xml @@ -9,7 +9,7 @@ <item> <title>Posts</title> <link>https://kumardamani.net/post/</link> - <pubDate>Mon, 12 Sep 2022 00:00:00 +0000</pubDate> + <pubDate>Tue, 29 Nov 2022 00:00:00 +0000</pubDate> <guid>https://kumardamani.net/post/</guid> <description></description> diff --git a/public/tags/personal/index.html b/public/tags/personal/index.html index 0a62c8a..54f34b3 100644 --- a/public/tags/personal/index.html +++ b/public/tags/personal/index.html @@ -43,6 +43,9 @@ <ul> + <li><a href="https://kumardamani.net/post/programming-as-art/">Romanticism in Programming</a></li> + + <li><a href="https://kumardamani.net/post/self-host/">Why do I self-host?</a></li> @@ -85,7 +88,7 @@ </section> <footer class="page__footer"><p class="copyright"></p> - +<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p> </footer> </div> diff --git a/public/tags/personal/index.xml b/public/tags/personal/index.xml index 311fe6d..1de66fc 100644 --- a/public/tags/personal/index.xml +++ b/public/tags/personal/index.xml @@ -6,7 +6,16 @@ <description>Recent content in personal on Kumar Damani - Home</description> <generator>Hugo -- gohugo.io</generator> <language>en-us</language> - <lastBuildDate>Mon, 12 Sep 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://kumardamani.net/tags/personal/index.xml" rel="self" type="application/rss+xml" /> + <lastBuildDate>Tue, 29 Nov 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://kumardamani.net/tags/personal/index.xml" rel="self" type="application/rss+xml" /> + <item> + <title>Romanticism in Programming</title> + <link>https://kumardamani.net/post/programming-as-art/</link> + <pubDate>Tue, 29 Nov 2022 00:00:00 +0000</pubDate> + + <guid>https://kumardamani.net/post/programming-as-art/</guid> + <description><p>Why programming I see programming as an art form.</p></description> + </item> + <item> <title>Why do I self-host?</title> <link>https://kumardamani.net/post/self-host/</link> diff --git a/public/tags/tech/index.html b/public/tags/tech/index.html index d75ea3a..a83daac 100644 --- a/public/tags/tech/index.html +++ b/public/tags/tech/index.html @@ -43,6 +43,9 @@ <ul> + <li><a href="https://kumardamani.net/post/programming-as-art/">Romanticism in Programming</a></li> + + <li><a href="https://kumardamani.net/post/self-host/">Why do I self-host?</a></li> @@ -85,7 +88,7 @@ </section> <footer class="page__footer"><p class="copyright"></p> - +<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p> </footer> </div> diff --git a/public/tags/tech/index.xml b/public/tags/tech/index.xml index 7bf143b..39ddf39 100644 --- a/public/tags/tech/index.xml +++ b/public/tags/tech/index.xml @@ -6,7 +6,16 @@ <description>Recent content in tech on Kumar Damani - Home</description> <generator>Hugo -- gohugo.io</generator> <language>en-us</language> - <lastBuildDate>Mon, 12 Sep 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://kumardamani.net/tags/tech/index.xml" rel="self" type="application/rss+xml" /> + <lastBuildDate>Tue, 29 Nov 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://kumardamani.net/tags/tech/index.xml" rel="self" type="application/rss+xml" /> + <item> + <title>Romanticism in Programming</title> + <link>https://kumardamani.net/post/programming-as-art/</link> + <pubDate>Tue, 29 Nov 2022 00:00:00 +0000</pubDate> + + <guid>https://kumardamani.net/post/programming-as-art/</guid> + <description><p>Why programming I see programming as an art form.</p></description> + </item> + <item> <title>Why do I self-host?</title> <link>https://kumardamani.net/post/self-host/</link> |
