I know writing from scratch is usually the best thing to do, but how do programmers in the real world handle the trade of between "writing from scratch" (more control of code, no copyright infringement) and "tutorials/borrowed code" (faster,*cheaper*, riskier... (putting it simply, programming in faith)).
If it's just one line or something you can just take it. Otherwise look if the author is using some kind of license for the code and see if you are al right with it. If the author hasn't mentioned anything you have to assume you can't use it, but of course you can ask the author to put it under a suitable license.
Writing from scratch is actually the WRONG thing to do. Don't get me wrong, it's great if you're just starting out on a concept and you want to know how it works from the ground up but when you go to actually make a useful application it's wrong to think that the popular libraries out there are all flawed and you need to write your own stuff for everything. If this were the case then you want to learn assembly not C\C++. Don't worry about "useless code" getting compiled into your application, modern compilers do an awsome job at optimizing out the stuff you don't need.
My case is in writing a Direct X10 game engine (2D anyway), and of course it's not quite a case of using official libraries but using the tools DirectX provides to write all the components I need.
But in this I've got the dilemma of relying on tutorials (which of course have their baggage, since it would have been made for a specific type of engine) and writing from scratch the right components. But sadly though from scratch is better for me since I get to understand more, it is sadly time consuming and I've been lucky that my lecture said he would be marking us as "programmers" and not necessarily coders.