DEV Community

Josh Hadik
Josh Hadik

Posted on

What's the Craziest Question You Ever Asked on Stack Overflow?

As developers who have progressed out of the "beginner" phase, we often underestimate just how far we've come. That's the nature of programming. Things that at one point seemed like the most complex thing in the world become second nature, so we write them off.

Slowly, over time, we become better and better developers. And as we grow, we often forget the pain we went through, which at best leads us to overlook our own talent and value, and at worst makes us hostile towards new developers ("You don't even know what X does? How can you call yourself a programmer!")

I thought it would be a fun exercise for those of us who have "been around" for a while to look back at some our oldest questions on Stack Overflow, the stuff from way back when, and share some of the "craziest" stuff we ever asked. The stuff that seems so basic and fundamental to us now, but at one point made about as much sense to us as quantum physics (or some other crazy complex concept if you happen to be an expert in the field.)

If you're a beginner reading this, I hope this discussion helps you realize that we've all been there, and if we can do it, so can you!

And if you're past the beginner phase, I hope this exercise helps you realize the value of your own skill, and makes you a little bit more understanding of and forgiving towards newer developers.

So here it goes.

What's the craziest question you ever asked on Stack Overflow?

Feel free to add explanations, code snippets, links to the questions, and any other information you want!

If you are a new developer and any of these examples are something you currently struggle with, I hope labeling them as "crazy" isn't off-putting. The intention here isn't to make anyone feel stupid for not knowing something, but rather to highlight that we've all struggled with the same fundamental concepts at some point in our developer career.

Top comments (5)

Collapse
 
joshhadik profile image
Josh Hadik

Here's mine. It's from way back in October, 2014.

What really stood out to me about this wasn't so much the question itself, but the code I wrote for the Playlist class:

class Playlist
  def initialize(*songs)
    @playlist = []
    songs.each{|key|
      add(key)
    }
  end
  def add(*songs)
    songs.each {|key|
      @playlist << key
    }
  end 
end

Putting aside the use of curly braces on a multi-line block, two things really stand out to me about this:

  1. I'm looping over an array to add the elements to another array when I could easily just set @playlist to the songs array.
  2. Not only am I looping over the elements in initialize, but I'm calling a second method that also loops over an array with each individual element before adding them to the @playlist array.

Thankfully someone on Stack was able to show me the light and help me realize I could easily refactor the class to the following:

class Playlist
  def initialize(*songs)
    @playlist = songs 
  end

  def add(*songs)
    @playlist.concat(songs) 
  end
end
Collapse
 
fluffy profile image
fluffy

For what it's worth, there is some merit in making a copy of the list, if you don't want to mutate the list that's been passed in at a later time for some reason. I'm not versed in ruby and I assume it does have a list copy operator of some sort, but there's at least merit in what you were doing, if not the mechanism. :)

Collapse
 
molly profile image
Molly Struve (she/her)

Totally could see my past jr dev self doing this!

Collapse
 
_bigblind profile image
Frederik πŸ‘¨β€πŸ’»βž‘οΈπŸŒ Creemers

I wasn't sure what the craziest one would be, but here's the one with the most views/votes, and I think it's definitely interesting.

How to create a Web Worker from a string?

At one point, I had the idea to build a web application with JavaScript challenges. I wanted to avoid the hassle of finding a way to safely run the code server side, so I decided to run the submitted code in a web worker.

I initially tried creating a data URI from the javascript code, but kept getting the error that it was a cross-origin violation. The solution ended up being creating a Blow, and getting an object URI for it.

Collapse
 
molly profile image
Molly Struve (she/her)

The first question I ever asked on StackOverflow was during my first month of learning to code

Trying to get rake sunspot:solr:run to execute

I was having issues getting the gems sunspot_rails and sunspot_solr up and running and solution after all the work I put in to writing an extremely detailed question...

This problem occurs when there is space in your source path. Move your code to a path like "C:/WaterCooler" and try.

Yep, space in the source path πŸ˜‚ Nowadays, that is something I would NEVER do but back then I had no clue! We all have to start somewhere πŸ€—