I recently set my final year software engineering undergrads a task to take a simple Google App Engine webapp and add a login/registration system to it. I made a point of advising my students to RTFM (read the *full* manual), highlighting to them that there is lots of great functionality provided with App Engine "for free" and that its all just sitting there, waiting to be exploited by savvy developers.
When my students submitted their work, half of them had done half of what I'd asked. These students created the datastore descriptions required to store user-ids and passwords, created some UI forms to solicit login/registration information from the users of their webapp, and then tied it all together with lots and lots of code to make sure the logic worked as required, providing a fully functioning authentication system for their webapp. These students were quite pleased with themselves as they'd obviously done quite a bit of work here. After all, look at all the code they'd written!
The other half of the class did everything I asked, including taking my RTFM advice to heart, and - suitably enlightened - simply added the following line to their webapp's configuration file:
login: required
This directive - described in the App Engine online docs - switches on Google's own login/registration system for a webapp and provides a fully-working authentication system using the same technology that lets you into GMail, Google Docs and all those other Google cloud services. Take a moment to think about what's happening here: all that functionality from a simple configuration directive and not one line of new code in sight!
Of course you may not agree, but I'd suggest that the Google engineers have this problem pretty much solved by now and that any attempt to write a custom App Engine login/registration system is, at best, ill-advised and, at worst, unproductive. Although there's a case to be made that there's lots to learn from "rolling your own", there's also the point to be made that the savvy developer knows what to concentrate on, that is: build only the functionality that's specific to a webapp... then "beg, steal and borrow" the rest. Knowing when to and when not to write code is skill worth mastering.
Now, as readers of this blog know, I'm a big fan of the "Less Code Is Better" principle, but I'll take no code over less code any day. And I'm always amazed when a developer (not just a student) insists on writing everything from scratch. What explains this blind rush to write code? Is it inexperience? Arrogance? Madness? All of the above?
What do you think? I'd love to hear other developer's views on this.







By 










When I was a student I made it a point to not use any existing libraries. I think it is important to take the long road and write all the code yourself to really learn whats going on. In a work environment I would agree with your point of view that less (or no) code is better use all the tools available to you. In school however I think it is important to not rely on outside sources. At University I had a programming instructor who insisted that we should search google for what we were trying to do and copy paste other peoples code and make it work for our needs. By the end our studies those people who took that professor's advice could not sit down and write a program from scratch, those who ignored him could. What do you think those students who can only copy paste the code will do when they run into a problem that has not been solved before?
So again I agree with you as far as real world application goes, but not in a learning environment.
Yeah, I'm with Zero. This post is a very good story if you're talking about real world applications, certainly. But your students probably assumed that writing code for the login system was the actual assignment. With most professors, if a student didn't bother to write the code for the assignment and just showed up with something written by someone else, the professor would say "Haha, very funny. You get an F. Also, you're suspended for plagiarism."
Zero: that sounds like an awful early programming experience. I'm sorry that happened to you and your classmates.
Zero and Polly: I totally agree that the school environment differs from the work one and your comments are all valid. However, the group of students that I refer to are all final year and already have a B.Sc. in Computing, so they are experienced coders already. They are taking an extra year to get an Honors in Software Engineering... and getting ready for the workforce, so my emphasis is more on practices that mirror what happens in industry as opposed to what's acceptable in an academic environment (which I'll admit is a little off the mainstream). I wanted them to take advantage of everything the App Engine API gave them... which was the whole point of the assignment (as that's how it works in industry).
--Paul.
I'm agree with ZeroRadius and Polly, I think that is important to know how the thinks are working underground.
But it really true the point of Paul Barry, because in the real work the time is the most important, and write less code using web engines, increase the quality of the software and decrease the time of developer it.
I'm a habitual "roll-your-own" programmer, as I frequently find using downloaded code to be more time consuming than writing from scratch.
When I download some solution to a programming task, I'll frequently find it doesn't *quite* work the way I want it to. Then I'm stuck in the position of having to understand somebody else's code in order to get it to work for me. Or it doesn't work at all, and the advice I get is to install a new compiler or driver or reconfigure my kernel or something equally arcane.
Maybe this is because I am a programmer with virtually no formal training, but 90% of the time, it is more efficient for me to write code that does what *I* want it to do--no more, no less--rather than struggling to adapt somebody else's code for my purposes.
As a former Computer Engineering teacher I think it's impractical (or even impossible) to build things from scratch. We use IDEs, don't we? Are the students plagarizing by using a compiler they didn't write themselves? And what about the Operating System? Should they build their own computers instead of using someone's else? We stand on the shoulders of giants, no need to be ashamed of that, and our students should be more interested in reaching new heights instead of trying to invent the wheel all over again.
Most of the time, less is more. Keeping things simple actually displays a lot of finesse. Forgive me for possibly butchering this quote, but I believe that Albert Einstein said that a person really doesn't understand a concept unless he can explain it in a very simple way.
I'm with OP and El Corsario Negro on this one. The funny part about Zero's post is this line "By the end our studies those people who took that professor's advice could not sit down and write a program from scratch, those who ignored him could."
First, I don't really buy it. If you've learned to code you've learned to code. Writing good code is easy, designing and architecting it for future-proofness is an arcane art no course will instill in you. At least no coding course will. In my experience as a student those courses where you write code have nothing to do with teaching you how to design good software, and those that teach you how to are usually boring theoretical stuff that students sleep trough.
So why wouldn't those people be able to solve unique problems, by biting public domain /open source stuff off the net they've learned a much more useful (and tougher to learn) skill as devs: to read, understand, appreciate and adapt other peoples code.
Second and more important thing is that people that tend to impulsively write code from scrach usually tend to write crappy software. Learn to stand on the shoulders of giants and you can cherry-pick the best of bread and, more importantly, adapt them to your needs. Learn to only write from scratch and you'll spend your career reinventing the wheel in the not-invented-here vicious circle.
This is exactly why in some common areas there are tons of programs that are very basic and not very usable, and were developed out of pure, simple vanity.
This is an example of the "re-invent the wheel" principle versus "re-use out of the box functionality" principle.
Normally, someone who's learning software development wants to avoid wasting time.
Both principles can be the best solution, depending on the expectations and circumstances:
a) "re-invent the wheel" or "not invented here" can take more time, but can give independence (patent risks, future).
I expierienced that successfull commercial libraries changed their interface (incompatible) version-by-version.
The amount of safed time, by re-using, quickly turns into maintaining, whis is a hidden cost factor.
Those cases happened and lead in bigger companies to investment for independent code, which could even solve patent risks.
b) "re-use out of the box functionality" needs really to meet expectations, even on the long run.
Open Source normally avoids these issues, that one good reason for it's success.
c) Relying on an Online-Service makes your solution depending on the availability of the re-used online-service.
If your provider is:
a) small you risk that he might break away
b) very large you risk, that other provide your solution more attractive than yours (fee, quality, etc.).
Your example is a poor one. Your application users will now be required to have a Google account, your application will only work within that universe, and your userdata will only exist within it as well.
This is likely not what a serious business wants to have. It wants to have control over its user data.
You're also not testing whether your students can write a piece of software here if you're intending them only to read the Google framework documentation and pick that line out of it to add to the configuration of something you provide them with, which is doing a disservice to all of them who've studied hard to get where they are rather than leeching fully made assignments from websites.
Were I tasked to add user authentication to an application, I'd always assume the customer wants the application to user either their existing user authentication data, or maintain its own.
I'd certainly never assume they want to use an untrusted 3rd party where everyone and their dog can create anonymous accounts as the source of authentication information, a 3rd party that won't share that data with me even as they're forcing me to share my businessdata with them.
The students who rolled their own systems did the right thing here (if they properly implemented it of course), those who just used the Google authentication system did their theoretical customers a disservice.
I'd have read the manual, seen what the consequences of using that standard login option are, and opted not to use it.
The answer to this one is simple: Programmers are writers. Programming, at its heart, is simply a logical way of expressing yourself. That's why we want to code (write).
You've probably heard, "nonono! Programming is a way to fulfill a set of BUSINESS REQUIREMENTS set by CUSTOMERS in a TIMELY and EFFICIENT manner, etc, etc". But really, what we're thinking is, "Man, it's a giant pain in the ass to have Billy over there manually scan in all those documents all day that Suzy prints from .pdfs we receive through Johnny's email. Can't we just STOP ALL THIS MADNESS?! -- Oh I know! This is something that logical expression can solve! TO THE BATCAVE!!"
Yes. But, if Batman already has a Robin, he doesn't need another one (that works just the same), right?
My Answer...My Admission
body {
background-color: #99ff00;
margin-left: 20%;
margin-right: 20%;
border: 1px dotted gray;
padding: 10px 10px 10px 10px;
font-family: sans-serif;
}
I love being geeky, actually
With those who disagree...
I do agree
For you see, I RTF directions before typing in the little text field.
"Comments (You may use HTML tags for style)"
I didn't have to do that, obviously, as it says "may" use.
But it's the word "style" that caught my eye.
For I never quite learned CSS the first time 'round.
Therefore, I admit...
I just HAD to code this
No code is better when truly not necessary. Time is also money. We have better and higher priority tasks and projects to deal with. For those who must write that code, I feel for some of them that it's all ego.
Of course no code is better but I must say that I agree totally with Zero Radius.
I believe that for some, the answer is frustration. (As far as the reason for the 'Blind Rush' to write code from scratch.)
P.S. Um... Although a geek, I am not a coder. I'm just a writer (and a lover of the "Head First" series) who found your "cooking" and coding posts to be interesting.
P.S.S. Also agree with Kevin Bartlett's response.