![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I was idly musing on my journal that DW is approaching the MVC model of web development, as it's got Controllers, in the form of functions that get called to handle pages, and Views in the form of the Template Toolkit (or even BML). It even has Routing (which doesn't get a letter in MVC ;) ) to bind the right url to the right Controller. What DW doesn't have is the M part, the Model, which is normally a class that handles access to a table in a database, and I was musing about this because some of the functionality would have been a bit useful for the work I was doing then, even if I do enjoy the fact that not fitting into the MVC concept means DW is a bit more freeform. Anyway, I was wondering if there was any reason that DW didn't have a Model class.
denise suggested that I ask, as often something doesn't exist because nobody's done it yet.
Do you think that a general database interface class, like a Model would be useful to DW? Do you think DW should go that way, or are people genuinely happy just hard-coding their SQL queries in various objects, as is done now? Admittedly, the DBI layer does a lot of what Models do, such as quote escaping and input sanitisation, although it doesn't quite do the same job, and it won't error check your SQL query input to check whether you are using the right fields and values, or automatically make your SQL queries for you if you provide it with sensible data and want to do a common operation. If something like a Model is useful, how far should one go with them? Do you find things like behaviours and relationships useful, or do they just get in your way?
Further, if I wrote a simple Model class, would anyone other than me use it? Would anyone know how? Would anyone even care? ;)
( Some concrete examples for people without any experience of MVC, to give you an idea of how it works (based on CakePHP's method of doing things, it's not exactly standardised). Unfortunately, MVC is a bit too much of a concept to explain quickly so forgive the jargon and crash course, better if you read up on it :( )
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Do you think that a general database interface class, like a Model would be useful to DW? Do you think DW should go that way, or are people genuinely happy just hard-coding their SQL queries in various objects, as is done now? Admittedly, the DBI layer does a lot of what Models do, such as quote escaping and input sanitisation, although it doesn't quite do the same job, and it won't error check your SQL query input to check whether you are using the right fields and values, or automatically make your SQL queries for you if you provide it with sensible data and want to do a common operation. If something like a Model is useful, how far should one go with them? Do you find things like behaviours and relationships useful, or do they just get in your way?
Further, if I wrote a simple Model class, would anyone other than me use it? Would anyone know how? Would anyone even care? ;)
( Some concrete examples for people without any experience of MVC, to give you an idea of how it works (based on CakePHP's method of doing things, it's not exactly standardised). Unfortunately, MVC is a bit too much of a concept to explain quickly so forgive the jargon and crash course, better if you read up on it :( )