Are code snippets evil?
Scobleizer: Microsoft Geek Blogger
Regarding snippets: Are you going to study them or are you going to just use them and use the over and over again?
What happens if you discover a bug in the snippet and you’ve copy-pasted it in several different applications?
Instead of snippets, they should have created “mini-assemblies” that could be truly re-used and extended. Being able to compile code-fragments, even just a single method, could be useful. It could be a nightmare too. Imagine a program made up of several hundred mini-assemblies? Ick, what a nightmare to debug.
The kind of code that would get encapsulated in code snippets are what I call mini-design-patterns. They are ways of doing certain tasks, e.g. creating a WebMail object, setting the server, creating the message and sending it or iterating over a collection and storing the index of an object you are interested in retrieving, that don’t really fall into a full blown pattern but the steps are static enough that they fall into a pattern like format.
