DEV Community

Cover image for What is the most fun coding problem you resolved?
Lorenzo Pasqualis
Lorenzo Pasqualis

Posted on

What is the most fun coding problem you resolved?

I had a lot of fun coding throughout my career. There are a few problems, however, that I still remember fondly as particularly fun to resolve. They weren't the hardest ones I worked on or the most important ones. However, at the time, they gave me a great satisfaction that I can still remember today.

Here are two examples:

Ads Probability

I was working on an online advertisement system for a hosting company, back in 2000. I had a list of banners that needed to be displayed randomly anytime a web page was rendered. For each banner, I had a percentage associated with it. The percentage represented the probability of that particular banner to be shown on a website in the system.

I had to write the code to show the ads with the correct frequency. The system was getting millions of requests per day (a huge number at the time), and it had to be highly performant. I had a blast working on that problem. The solution I implemented was simple and fast (at worst O(log n)). I used variations of it over the years for different problems.

Fast Memory Allocation

The second one is from 2003 when I was trying to optimize a virtual machine designed to run on a mobile device. Mobile devices were slow at the time. Very slow. The virtual machine was not performing well on a particular device, and I spent some time profiling it. The code was written in C++, and I realized that what was slowing things down was the memory allocation system on the device (not shocking).

Any time an object was created with "new," the allocator took too long to do its job. I decided to create my own memory allocator, highly optimized for the particular application I was running, which happened to create many very small objects. The result was an immediate 95% performance boost across the board.

What about you?

There are many others, but I'll stop here. What about you? Are there problems that you remember as particularly fun to resolve? What were they?

If you enjoyed this post, keep in touch!

Top comments (13)

technicalgeekry profile image
Angela Reeder

So, um, keeping in mind that I am VERY new to coding...a client wanted a section on their site with tabs, with a very specific format for the content and he wanted them to be the same color at first then change to different colors when they were clicked. I had never done much more than a bit of html and css and had never used much else. It was a lot of work and frustration but I finally got what they wanted. I was so excited and that has been my favorite project so far.

lpasqualis profile image
Lorenzo Pasqualis

Awesome, thank you for sharing!!

ben profile image
Ben Halpern

If you're new and already having fun that's a pretty good sign!

lexlohr profile image
Alex Lohr

One of the first tasks of my new position required me to create a component for a layout of multiple lines of a changing number of elements with different aspect ratios.

The solution came to me on my bicycle ride from work after hearing the problem: I didn't care about the actual sizes, but only about the aspect ratios when dividing them into lines.

Another team saw my solution and included it into their implementation on a different system as well.

timbutterfield profile image
Tim Butterfield

One of my most fun problems to solve was back in 2008. It was porting the XDR messaging of a large C++ application on Linux to work cross-platform with C# applications on Windows. The end result of the multi-phase solution was an automated synchronization of the messaging code during the builds. A post-build step of the Linux project output an XML file containing the enum values and structures of all of the supported messages. During the build of the C# solution, that XML file output from the Linux build was used as input to generate C# code. This allowed the C# developers to use message classes with native C# types for each member of each message and easily send/receive those messages with the Linux C++ apps. Any change made to messages by the C++ developers on Linux was automatically pushed to the C# developers on Windows with the next build.

kairias97 profile image
Kevin Irías

Like two months ago there was a company here at my country that had a section of visitors count for each promotion they had, which were acquirable through buying coupons, so I investigated through the browser and found the counter increased per page load and using a http call to a webservice, so I followed its structure of call and made a console application in c# that made thousands and thousands of api calls and using parallelism, so in a short time one of the promotions had like 314k visits. It was funny because I build up something just for purposes of curiosity.

erhankilic profile image
Erhan Kılıç

Point in polygon problem. I will write an article for this :)

scottishross profile image
Ross Henderson

My first breakthrough with Oracle APEX 5.0 was when I figured out how to do a dynamic navigation bar through PL/SQL. The navigation bar can have new parent/child menu items added from a seperate admin page, including links, icons, whether it opens in a new page or not.

Took me about 3 weeks of butting my head against the wall, with only 1 forum post that was very hard to decipher that may have spoken about something I could have potentially used, maybe.

But it definitely made me interested in coding as not only a career, but has a hobby.

dougmckechie profile image
Douglas McKechie

I have had a personal interest in HTML canvas for some years and about 4 years ago a client wanted a hero image slider on the homepage of their website with a very specific set of animations I didn't think could have been achieved with CSS, so I successfully used HTML canvas to achieve what they wanted.

It was fun and memorable for me because I got to do some paid work using a technology I was interested in and deliver what the client, who had very strong views on how the homepage should look at operate, wanted. So a win-win.

mgosoriok profile image
Mok • Edited

One of my very first coding challenge was in 1994, I was working printing B/Ls (Bill of lading) ... everything was fine, all fields placed in the proper place , nice fonts and colors... so when the users saw that everything was in the right place, he asked to place automatically (or automagically!!!!!) the stamps that they put manually... In the most of languages you don't know what you sent to the printer after that you already did it... well finally I could resolve it creating a matrix in order to store the print outs , then look for the available space to place the STAMPS.... Usually they call me to RE DO the programs after the programs is not being supported by the O.S...... (4 times in 25 years!!!!!!!!!!!! :-) )

jdsteinhauser profile image
Jason Steinhauser

I worked in a lab that recieved data in over 50 different formats. I created a DSL for reading/writing most of those files in by specifying the format in an XML file. I removed 15k SLOC from our codebase, and took developers mostly out of the critical path for analysis.

dmfay profile image
Dian Fay

Pulling individual datasets out of a shared database by walking the relationship graph record by record and key by key to map the structure, then toposorting related rows out in dependency order.

rhymes profile image

Recently: building an API server as my first Go app, then looking at the footprint of such app and exhaling a "wow, that's awesome" :D

Learning new technologies is almost always fun.