"perl elif or elsif" - I remembered enough that "else if" wasn't the correct syntax in Perl, but couldn't remember which of the common alternates it was.
"perl conditional string compare" - I couldn't remember if it was "eq" or "-eq".
"perl string concatentation" - I actually had bugs in my script because I thought "
+" was supported in Perl. Whoops, it's "
." in Perl.
"perl break continue" - Script errors informed me that I was using the wrong syntax. Had to out right Google the answer b/c I couldn't remember it (in Perl it's "last" and "next").
There might have been a few more searches.
Needless to say, Perl is not my bread and butter language. It's something I use once in awhile because I need to script something of some complexity just beyond a shell script. When you jump between languages, the exact syntax of what you should be using can become a blur.
So it lead me to this question I think about once in awhile "Am I a professional Googler?" There are times I spend way more time Googling than I would like to or think I should be.
First, is Googling an answer bad? Admittedly, it is something that just feels bad. A large part of this is because when you can't recall things from memory, you tend to think of yourself as stupid. In some ways, it makes you feel lazy. That perhaps reading a book would be wiser or finding the answer in a book would be the "smarter" thing to do.
IMO, this isn't the case. You can't remember everything. Many things I've done professionally in my career I haven't done from memory. Significant portions of programming knowledge came from books. When I needed a piece of information I developed a mental index of where to look in my mountains of books for specific answers. In fact, I distinctly remember having to go to my Perl book to look up "What's the perl equivalent of break & continue" in the past because I couldn't remember it then.
Eventually that mental index simply turned into Google. Various blogs, technical documentation, and StackOverflow have turned into the books on my shelf.
So I do not believe there isn't inherently anything wrong with Googling various answers and it doesn't make you any less smart.
Using Google to recall syntax nuances is one thing. I think there is a mental line one crosses to begin to wonder, "Am I really Googling too much?" At some point are you barely even programing?
I like to think of a recent project I worked on called Magpie.
Originally, I had more grandiose Big Data goals related to Big Data on HPC. But as things sometimes go, a far more humble solution using just Bash scripts was found to be just as much, if not more, useful than many of the original project ideas.
These Bash scripts were initially hacked up because they were meant to be "support" for my actual work. When we determined that the support-ish Bash scripts were what people found to be the most useful product of the work, did we turn it into a more polished product.
I never sat down and actually learned Bash scripting syntax at any point in my life. Basics such as conditionals and loops were cut and pasted from online guides when I've had to develop small scripts before. More nuanced things were gleened from more Googling and cut and pasting. There were many searches for "bash" + "sed|awk" + "some pattern" because I never learned many of the advanced features of sed or awk or any of the advanced Bash-isms.
I've cut and pasted my share of code before. Whenever I've needed a function that I deemed reasonably common and didn't want to write on my own, I was able to find one online. But this was different. I felt that I cut and pasted an entire solution together from stuff on StackOverflow. To be honest, if I was given simple interview programming questions and asked to do it in Bash, I doubt I'd be able to do it.
In contrast, I think of how I originally learned to program in C. I took a small C programming class in highschool. In college it was in a few of my classes. I read about half of the famous Stevens network programming book in college and the rest once I began my career. There were other books too. My programming expertise in C was hardened through many homework assignments, work assignments, and bugs.
Granted, C is a far different beast than Bash, but when I learned C the web was just in its infancy. A few not-great search engines like Excite and AltaVista existed. Google was just coming online. There was no Stackoverflow or blogs with help on individual niche topics. So learning it primarily meant you had to learn from scratch. So C programming is simply backed into my brain.
I wonder if things would have been the same if StackOverflow was around when I was first coding in C? Would I have not ever read the Stevens networking books and coded through StackOverflow? Is this what people do in college now doing their assignments?
It's something I've pondered. But getting back to the original question ... Am I a professional Googler?
I eventually realize the answer is no.
In actuality, it takes years to get the point that you can become proficient enough to actually understand what it is you are looking for so you can cut and paste off the internet. When you find the piece of cut & paste that is correct, you know it and you can use it.
What I have to remember is yes, I did cut & paste off the internet for much of Magpie. Perhaps it does make you feel lazy. But it was individual lines of syntax, not an entire solution. The real meat of Magpie is all of the Hadoop, Spark, etc. knowledge in Magpie within the scripts. I just needed bits of code to piece it together.
It's no different then when you cut & paste from your personal library of code. The first time you need to program something tricky, you really figure it out. But everytime you need it later, you cut & paste (or if it's a library, just call it, etc.). But eventually, you probably forget all the subtle details you put into making it robust and solid in the first place. Do I remember all the details of how to make a portable non-blocking connect call? Absolutely not. But after I wrote it the first time, I used it several more times over.
While writing this blog post, I had almost forgotten something. While I was developing Magpie, I did write many 5-10 line scripts off to the side to figure out "is this how the syntax works?" or "is this what I'm looking for?" I had completely forgotten this reality. So I didn't actually blindly cut and paste all of the time. And of course I did eventually learn some things.
And ultimately, at the end of the day, one tends to invest time in those things they think worthwhile. Do I consider Magpie to be of some complexity that it requires my attention to learn all Bash syntax in depth? The answer is no. So I didn't bother to.
Post a Comment