33

Possible Duplicate:
Importance of learning to google efficiently for a programmer?

Avoiding lengthy discussions, as a senior level student in CS, how can I get away from Googling problems I run into? I find myself using it too much; I seemingly reach for the instant answer and then blindly copy and paste code, hoping it works. Anyone can do that. I've read the related threads about being a better programmer, but mostly those recommend practicing on pet projects, which I have done, but again I feel EVERY wall encountered, from design through completion, was hurdled with Google.

Do professionals instantly "research" their problem? Or do you guys step back and try and figure it out yourselves?

I'm talking about both 'algorithm/design' problems as well as compiler issues.

13
  • 66
    you're asking the question on a programming question-and-answers site. You are polling a population that clearly believes in using the internet to find answers.
    – psr
    Oct 12, 2011 at 20:53
  • 29
    There's a difference between googling to understand the problem and just finding some code to copy/paste.
    – cHao
    Oct 12, 2011 at 21:02
  • 28
    and then blindly copy and paste code, hoping it works Never ever copy code you don't understand! Oct 12, 2011 at 21:18
  • 1
    Ask your professor for harder problems!
    – user1249
    Oct 12, 2011 at 22:36
  • 2
    googling isn't the BAD THING, blindly cutting and pasting is
    – user29776
    Oct 13, 2011 at 20:14

22 Answers 22

81

I research most problems I encounter.

If I encounter an issue, my first assumption is that I am not the first one to have encountered it.

I also don't believe in reinventing the wheel - so will look for an existing solution before writing my own.

The thing about research is that you need to evaluate the results and how well they fit (or not) with your code base/model/project/team. This means you need to understand the solution, how it works and how to apply it to your situation.

My research saves my clients time and money.

Before the days of search engines, I asked questions on usenet. The Internet is a great tool - use it.

5
  • "you need to evaluate the results and how well they fit (or not) with your code base" - I've found myself googling before I have a code base Oct 12, 2011 at 20:45
  • @TheRubberDuck - Answer revised...
    – Oded
    Oct 12, 2011 at 20:46
  • 18
    +1, and "evaluating the results" should include reading and understanding the code rather than blindly copying/pasting it.
    – CaffGeek
    Oct 12, 2011 at 20:58
  • 7
    +1 for "If I encounter an issue, my first assumption is that I am not the first one to have encountered it." Overall, this answer is almost word for word how I would have written it. Oct 13, 2011 at 2:50
  • You don't just have to fit the answer in with the code base. You've also got to fit it with the culture of where you work and with what the customer is willing to accept. (Which is why I write Java code. Ho hum.) Those parts apply before any code is written at all, as well as later. Oct 13, 2011 at 15:46
25

Google is a tool, and you shouldn't feel bad about using it to your advantage. Looking up problems is not a bad thing. Why spend an hour solving a problem that may have already been solved, and in a better fashion, then what you may come up with.

With that being said, I would attempt to understand why the solution you find works. Blindly copying and pasting code definitely won't get you anywhere, and down the road if problems arise from that code you will have a much harder time trying to solve them.

3
  • "attempt to understand why the solution you find works" - takes a lot of self discipline I don't have to slow down and do this step, will attempt to improve in the future. Oct 12, 2011 at 20:47
  • 4
    +1. Think of Google as having access to lots of people who've been where you're trying to go. You're going to get answers, but you still have to develop the skills to critically evaluate those answers to see if they're sane.
    – Blrfl
    Oct 12, 2011 at 21:15
  • 1
    Often the answers I find on Google prompt more questions in my mind.
    – B Seven
    Oct 13, 2011 at 22:18
10

Googling for answers is a good practice: you are digging into the experience and knowledge of hundreds and thousands of people who just may have faced the exact same problem you have and can help you solve it.

As for blindly copying and pasting, well that's how we learn too. It's exactly what we do with our text books: typing out the code from the page into the IDE without quite understanding all of it just yet (if you did understand it already, you wouldn't want to see it run).

Eventually you hope that understanding will come: you're doing it right if you manage to learn something. But there is always more to learn, solving one problem just makes room for the next problem - so don't feel ashamed to get help when you need it.

If your c&p is truly blind, you will not progress; your ability as a student or professional is not measured by your capacity for Googling, but by your ability to understand and interpret the results and to develop your skills over time. Blind c&p is un-rewarding in the long run. Even for those problems where I had a magic c&p="wow, it works now!" I was never truly satisfied until I went back over it until I figured out how it works.

Sometimes you will find that Googling doesn't help. Particularly as you start to get more specialised either as a researcher or working developer, you will more often than not get an error message, type it into Google and to your astonishment see:

Your search - "Exception while unfenargling the heeble-blerg: why did you do that?" - did not match any documents.

Then will come a true test of your skills...

1
  • "typing out the code from the page ... (if you did understand it already, you wouldn't want to see it run)" good point.. Oct 13, 2011 at 19:25
5

You don't just want to copy and paste answers; that's how you stay a terrible programmer. However, by looking at the work that others have done before you, you can start to understand the patterns that emerge to solve common problems, and apply them to your own code.

As a current CS student, it's unlikely that you haven't encountered many problems that have yet to be solved. In all likelihood, your exercises are themselves pretty trivial, and it won't be until you've got the time to really cut your teeth on real world exercises that you start to gain a better applied knowledge of software development. This is to be expected -- it's why the position of Junior Developer was invented. Don't sweat it, at this point in your career, a huge part of the battle is simply knowing how to find answers.

5

I agree that the internet is a tool that should be used.

That said, you need to be mindful of the license any code you use from the internet has been released under. If you copy some pieces of GPL licensed code into your company's proprietary code, then that could end up causing some real problems when people come saying that your company now has to release its proprietary code under the GPL because it's a "derived work". When I interned at Microsoft, my manager warned me against even looking at open source code too much.

Of course, this isn't as much of an issue when you're in school because you're typically not selling or distributing the programs you write for class.

4

As a professional programmer, I always find myself Googling things I need to know and don't.There is simply no better resource than the Internet to provide answers to questions.

However, this brings up two important points:

  • Information on the Internet is not always true or correct. Believe it or not, the information on the Internet is put there by people, and those people are not infallible; they may have an honest mistake of fact, or they may somehow get a jolly out of misleading others. So, always double-check information; there are usually plenty of sources, and if they all agree you can be pretty confident in the correctness of the answer.

  • As a student, and even in your career, you should always understand the "whys" and "hows" of an answer. Sure, you are almost certainly not the first person to have encountered a particular problem in computing. The only people that have truly unique problems are the true "computer scientists" who are developing the next generations of computing devices; the limitations, patterns and solutions for problems to the modern electronic microcomputer are well-known and well-trodden. However, just because they're known doesn't mean you don't have to know yourself. Sooner or later, you will be called upon to know how something you have put in works, either to modify its behavior or to explain its current workings to someone else. Not knowing in these cases will hurt you professionally. So, when slapping in an implementation you got from StackOverflow or CodePlex, you should always trace it, research any unfamiliar built-in objects or calls, and generally familiarize yourself with the structure, pattern and flow of the algorithm, so that even if you didn't invent the answer, you now know why it is correct (or sometimes why it may NOT be correct in a certain situation; for instance, not all sorts are created equal).

1
  • +1, "always trace it, research..., and generally familiarize yourself with the structure...of the algorithm, so that even if you didn't invent the answer, you now know why it is correct" Oct 13, 2011 at 20:31
2

Nothing wrong with Googling stuff, but how you Google is important. 'Blindly copying and pasting' does not sound like a constructive way of doing it. A better way of approaching it is to think of it as learning from the experience of programmers who are more experienced (and in my case, often cleverer!) than you. Almost all of the problems you come across will have been solved by someone else in the past, so save yourself the time by not going down all the dead ends they did and learn from their experience. Another wise thing to do would be to not just go for the first answer, but to evaluate many. And of course, when it comes to using certain tools, you're looking for right or wrong answers.

And instead of Googling, you could just go direct to Stack Overflow or Programmers SE!

But seriously, Google is a tool used by all professional developers.

2

A good programmer is one that knows a lot. A great programmer is one that knows where to find everything.

It is rare to have the capacity to remember every fine detail of what we do. There is just so much technology out there (languages/frameworks/platforms/etc.). Sometimes you need to research documentation. Opening a resource book or Googling it, the result is the same: your solution. (provided you are looking at a reputable resource on the internet)

1

It is always good to research what other people have done in a similar or same situation and learn from them, instead of re-inventing the wheel, slowly and incorrectly. As long as you strive to learn from the solutions you Google, then you are in good shape!

1

Here's the thing with google:

There is nothing wrong with consulting google/stackoverflow/etc for help. However, I wouldn't just blindly copy/paste the code as it's most likely not going to integrate right. Use it as a launching point and go from there.

Don't be afraid to use google. I would rather an employee google a problem than waste time spinning their wheels. We've all consulted google - and that's a good thing

1

If I don't know within a few minutes of looking at a problem how to solve it or at least have some ideas, I Google it.
The reason "expert" programmers are experts is because they have experience. If my current level of experience does not solve a problem, I need to learn about it and gain more experience.

As a software developer, you will learn for the rest of your career. When you stop learning, that's when your career starts stopping.

EDIT
I forgot to mention, when you find an answer that works by going on Google, you aren't done learning until you understand why that answer worked.

1

Are you copying and pasting a line of code or several lines just out of conveniance? You're always going to run into something you don't know. Sometimes it's so much the size of the language, but all the frameworks just keep piling on. It's not going to end.

If you keep searching for the same thing over an over, start your own set of cheat sheets or code samples.

Take some time to understand what you're copying. It takes understanding and repeated use before you gain any fluency. Some things you'll just do once.

In some cases, you're better off searching for a solution even if you know you can solve it on your own. Then you can compare and contrast and pick the best one for your situation.

Hate to tell you, but unless you start working with some minimal language in a narrow domain, you'll be searching for quite some time.

1

Maybe you should do some "in the field" or "real time" problems... where you don't have time or the resources to Google. Off the top of my head some of these involve ship board activities. For example the University in my area has some ROV related projects that CS students work on. While the project is developed on land (with google), when you're in the field trouble shooting, you have less chance to use Google. I'm not sure how practical this answer is for you, but I noticed that field techs (good field techs) are some of the most resourceful people I've seen. They're able to solve problems w/o Google etc if they have to.... but yes, these days, they have to less and less.

Another field activity would be GIS related stuff, where you're way out in the field testing / using GPS devices. Many of these places will have no internet, but you'll have your laptop and you'll need to get stuff done with it.

Think of places where there's no internet, and go and do computer stuff there.

1

Often, when googling, I find a better approach to solve what I was after, and actually learn something new.
That's very valuable - up there with a code-review by a better colleague.
Don't shy away from getting input into what your trying to achieve!

1

I KISS Google.

Whatever solution Google gives me, I try to remove as much code as possible to get the minimum that solves my problem. This implies that I must understand what Google provides. Sometimes I end up with a totally different solution.

1

Let me share a quote from my computer science professor, who was anti-Google:

USE THE MAN PAGES!

The man pages are the most authoritative source on whatever function or topic you need to research. I normally read the man page first, then if I can't find an answer, I go to Google (well, actually DuckDuckGo).

1
1

I always trust my ability to come up with something, which is not necessarily beautiful. Then I try to improve on it. In case I really be stuck on something, I'll look for some inspiration on the web.

As a student, to not concentrate on what, but to look into why is what really matters. Learning is about raw creativity and aesthetic sensitivity. To me, nothing ever compares to originality. To rediscover or to reinvent something makes an awful lot more sense than to just know or master something.

The web is merely a tool but not instrumental in developing our ability to discover and to create something truly beautiful.

0

I find that I reach for Google more when working on a small codebase, or when I don't know the language, framework or libraries I'm working with.

If you want to experience working without copy-and-paste, pick your most familier language, and find the biggest interesting open source project in that language. Try working on it, and maybe even try finding some open bugs to work on. You'll probably only use Google to understand the project and code, and never reach for CTRL+C.

0

Back when I knew one language applied to one methodology/interface (in my case it was Perl/CGI, which give you a sense of my vintage as a developer), I knew everything about it. I literally had all of Perl in my head. Regular expressions, IO syntax, even those old-school <<<|..|<<|>>> reporting string controls, I knew them cold.

The minute I learned my second language, not only was I never able to attain that kind of retention, I also lost Perl. It doesn't help that my second language was PHP, which has no interest in language consistency, in terms of function names or parameter orders.

In the interview for my current job, I gained points with my now-manager by admitting right up front that Google is my best friend. I'm not shy in the slightest. Today I'm going to need to google the phrase "Spring MVC file upload" to tackle a function I've done many many times, but in a language and framework I'm new to. I fully expect I'll find more or less fully formed answers that I'll need to adapt into my framework.

0

I think you have already discovered that the short answer is "yes, use google all the time."

Frankly, you have things backward, in a job, you don't have to prove you understand a concept, it is the results that matter. So you can google things more not less. You ultimately will have to understand certain concepts, but frankly you can developing conceptual understanding by just googling things.

If you come up with something and it doesn't work, you'll just google some more and find the answer. You'll probably also understand what was wrong with answer number #1, meaning you have enhanced your understanding of the underlying concept. This is called "learning by doing."

So as a journeyman programmer, I start learning things on quick how to guides and do more research until I build what I want. How to research things correctly is an art in and of itself. I think you will find you learn the right things to type into google, when you should just ask questions on stackoverflow, and when you should just read source code.

0

I usually Google problems pretty quickly, but there is something to be said for thinking about problems before you search. This will obviously depend on the type of problem, but by thinking about a problem before you read the solution, you will be likely to remember more.

0

I'm going to take a contrarian position to most of the answers here: as a student you should use Google only as a last resort. Actually, using Google is fine for looking up API signatures, man pages, or bits of language syntax. But, if the assignment is to write your own implementation of some data structure or protocol, you should aboslutely NOT be copying code from the web. If you do you are just throwing your tuition money away.

School work is different from work work. At work the goal is to create a working piece of software. At school the goal is to learn computer science and software development. Rarely will any of the software you write for school ever get run again once it's turned in. The entire point of the exercise is to make you think hard about the problem, have you chase down some of the blind alleys, and see why they are blind alleys.

Back in the 80s there was a popular movie called "The Karate Kid" (it's just been remade, but I have no idea if someone your age is familiar with it). In the movie a young kid asks his neighbor to teach him martial arts. The neighbor agrees, but says the kid has to to earn the lessons by doing some work for him first. He procedes to have the kid paint his fence and wash his car, over and over again. This drives the kid crazy, because he doesn't care about that crap, he just wants to kick the butt of the neighborhood bully. Of course in the end it's obvious that the neighbor didn't actually care about getting his fence painted or his car washed either; he was making the kid go through the exercises to teach him discipline, patience, balance, and coordination. So it is with your college assignments. The point is not just to complete the assignment, it's to learn something by completing the assignment.

You already know how to use Google. Use your college projects to learn something new.

Not the answer you're looking for? Browse other questions tagged or ask your own question.