Archive for the ‘Frameworks’ tag
Frameworks Over Code Generators
Developers are lazy and that is a good thing. Developers that aren’t lazy are bad developers. What am I talking about? It’s simple. Good developers are always looking for ways to simplify what they are doing. The result is simplified code that is very effective and reusable. Without this, we would all still be writing code in Assembly.
That being said, there are good ways and bad ways to be lazy. One of the most common ways is to do as Dreamweaver does and provide code generators for common programming tasks. Beginning developers love this approach and do benefit from it to some degree. For example, code generators are like built in tutorials that can show how to perform a common operation. For example, let’s say I need to run a query on a database and return the results. I could go to the PHP Website and start to look around for instructions on how to do that, but that could take hours if I’m really new to php. Instead, if I’m using a code generator, like Dreamweaver, I simply setup my database in the UI and then choose an option to perform a query. Using a simple UI that uses language that newbies understand I can setup my query and when the wizard is finished I have a bunch of code in my doc that will perform the query I need. When I look at my website it works great and I’ve saved a ton of time.
But what if the website doesn’t look like, or work like I wanted? Herein lies the biggest problem with code generators. Newbies can use them as a crutch instead of learning the language like they should. When things break or don’t work the right way, they are stuck. Then come countless hours stepping through code that looks like it was written in greek trying to figure out what the problem is. Not my idea of a good time
An alternative approach to code generators for streamlining development is utilizing frameworks. Frameworks are simply libraries of code that abstract menial and repetitive coding tasks and also provide you with a more organized way of doing things than from scratch. Although they do automate things for you, they don’t rid you of the privilege of writing your own code. Another advantage they provide is that they take care of a lot of the gotchas that newbies often run into when trying to learn a language for the first time.
Although frameworks can also break and leave you hanging, in general they work really well. In addition, if you are using a popular framework then there is bound to be a blog post or a discussion thread online where someone has run across the issue and has found a solution. Frameworks typically follow a “convention or configuration” approach and because of that, the learning curve can be a little steep on some of them. They don’t, however, hide you from the language itself and in most cases, will demand that you learn the language really well to use them effectively.
My experience with frameworks is that they can get you up and going really quickly and in the process teach you a great deal more than code generators about the language you are coding in. As such, for a teaching tool, they are far more effective than code generators. After spending a month in a framework, you will have a much better running product and a more in-depth understanding of the language by using a framework than you possibly could using a code generator.