DEV Community

Niels Bom
Niels Bom

Posted on

Which piece of code are you most proud of?

We sometimes talk about terrible code, especially when we talk about the code we ourselves wrote not too long ago.

But what piece of code were/are you particularly proud of? What did it do? And why are you so proud of it?

I’ll start off.

I’m still proud of writing some JavaScript some years ago, around 2011. There was a search field in a big page full of links (a famous Dutch portal website). This field could not just be used to search using Google but also visually show which links from the page were relevant.

I’m proud of the code because it had to run through a big data structure on every key press and filter out the unnecessary data in it. The first implementation was very slow because it did a lot of DOM operations. For the second version I created a crappy form of what you would now call a virtual DOM, do all operations and then do way less operations, making the feature fast enough for production.

Top comments (4)

Collapse
 
ohffs profile image
ohffs • Edited

I remember many years ago writing a little 'bootloader' demoscene type thing in M68000. It did various fancy graphical things (for the time!) - but the bit I was pleased with was making it run full-screen. At the time displays still had a big border around them - but if you flipped the TV (yes, this was a long time ago) from running at 50hz to 60hz and back exactly at the right moment then the electron gun would kind of 'jitter' and you'd end up without the borders.

Which is kind of tricky to do when you've got other things going on - no concept of 'threads' or anything and it all had to fit into < 512 bytes to fit in the bootloader.

Anyway - simpler times ;-)

Edit: this was the kind of thing : youtube.com/watch?v=PK_mgSmjFfE

Collapse
 
nielsbom profile image
Niels Bom • Edited

Very cool, supercool "hack" with the screen border too!

I always remember this 4KB demo Hartverdrahtet by Akronyme Analogiker, extremely beautiful!

Collapse
 
ohffs profile image
ohffs

That is very nice! :-) I sometimes think demoscene code is the 'purest' form of coding - just done for it's own joy and using every ounce of computing available to you.

And then I see my node_modules directory is 257 megabytes and have a little cry... ;-)

Collapse
 
edwinthinks profile image
Edwin Mak

Hey there!

I honestly think we people in software are often too hard on ourselves (including myself of course ;)). And it is good to bring to light some things we are proud about! So thank you for bringing up this discussion :).

Here is mine:

I wrote an algorithm for my first job/professional experience that managed the logistics for a fleet of food delivery people that was shared across several restaurants in New York City. This algorithm would try to pick the best delivery person based on geo-location & also told them which food packages they should pick up / deliver and in which order.

I loved this project because it really really sucked at times and I got a chance to make it better. The iterative process is something I found so beautiful and enjoyable. There were moments that we royally messed up and we learned from that.

In a way this code is really a representation of growing and learning. This is why I loved this and programming in general :)