Re: [WebDNA] Webdna and CMS
This WebDNA talk-list message is from 2012
It keeps the original formatting.
numero = 108082
interpreted = N
texte = >> - MVC design will save vast amounts of maintenance headache; =separation of logic from presentation (separate the webdna from the =HTML/CSS/JS that spits out to the browser as much as possible).>=20> MVC is something I've been hearing a lot about lately.>=20> For the most part, I think in our context, we mostly could benefit =from the use of a MV system (separating the WebDNA from =controlling/viewing templates as much as possible to allow versatility =on the front end). What would be the Controller aspect?.. javascript =handlers, AJAX, Flash I suppose.>=20> Anyway, I'm curious how WebDNA'ers perceive the MVC architecture when =related to WebDNA or PHP apps.Preface for the people wondering what MVC even refers to:How many times have any of us webdna coders (esp. those who have been at =it since the mid-late 90's) been working on some legacy file that is a =mix of spaghetti code and intermingled webdna/html and wanted to change =what gets displayed under some circumstance.. some (presumed small) =change needed.. and you set out to make the change only to realize that =to make it work right you have to re-decipher so much more of the file's =spaghetti logic than you set out to do that session *because* the =original design (perhaps your own ;-) was not as smart as it should =have been... for one small example: you need to alter the output of some block =higher up the page, but to do that you need there a variable that does =not get created until further down the page.. and you feel the urge to =pull your own hair as you realize how much more time and brain juice =this is going to take to sort it out right. Maybe you can just move the =variable up higher.. but maybe it is not that easy.. because of the =intermingled login/presentation code.My understanding is that the:- Controller (C) part is where all the business logic decides that gets =done what will get displayed.- Model (M) part is where all the db interaction happens (whether we are =reading or writing records)- View (V) part is where we assemble the display output. Views display =static things mixed with chunks of dynamic output that were handed it by =the C (and the C may have been handed some of its data from an M)My answer to Donovan: (I decided to *show*, rather than try to =*explain*... stay tuned.. see below.)I gradually learned on my own to use functions to call blocks of code =and also to define and fill vars way at the top, and to store display =output in vars, rather than just dump content right out to output... so =that I can precisely dump to output just when and where I want, with =just the variable (e.g. [output]).And that ^^^, if done well, allows me to do a lot of separation of logic =and presentation...=20But if a file is long and complicated.. then it can still be hard (or =just long-winded) to follow the logic when it comes time to make a deep =change many months later.I learned a great deal more about making MVC work for me, by forcing =myself to use the PHP framework "Code Igniter" (as I mentioned =recently).Some part of me wishes any one who wanted to deepen their MVC practices =to learn Code Igniter, because I have had (am having) a good experience =with it... and I would like to see a similar framework to Code Igniter, =done in Webdna, as much as we can emulate it anyway without true =classes, etc..The coding style forced by Code Igniter would likely not come =intuitively at first for many webdna coders... and others here who would =try it out might feel they can combine the M and C into one space.. but =for a large project I recently learned how nice it was too keep all db =calls (M) separate from the long business logic code (C)... both of =which are also separate from the HTML/JS/CSS output (V). I would =recommend anyone who wants to pursue MVC with PHP, or in context of =trying to write a new Webdna CMS, to use Code Igniter for a project, to =learn it... but then I thought: how many here really want to learn a =whole 'nuther system... ; it is a huge time-expenditure to learn a new =system written in a different language, just to learn MVC. But when you =see it done well, then you will never forget the clarity that comes from =clear separation of logic from output. So I would recommend the =exercise, *OR* wait until one day when someone may offer their MVC =Webdna CMS here. I decided to take a stab at making a sample start to =such a framework (at least the MVC aspect to start with, if not yet the ="CMS")... and named it "WebdnaCodeSparker" ("WCS" for short). I'll =post it to the list ASAP.. probably in a couple/few days (other =responsibilities are pressing). It would be nice if others (qualified) =would like to help develop it too.. so it becomes something we all (or =many of us) might like to use. If more than a few people do say they =want to jump in, then I'll look into making a git repo so we can =collaborate. Alright? I won't have time to do more than what I'll post =here in a couple days, before a couple/few months, because of several =backup up responsibilities, so with any luck my start will be enough for =others to pick up for now. Or maybe no one will be interested? Who =knows.. Anyway I am enjoying the experiment.. as I wanted to see if I =could recreate even a few of the loads of GREAT features of Code =Igniter. I think I will have added at least the following features by =the time I post:> - MVC design will save vast amounts of maintenance headache; =separation of logic from presentation (separate the webdna from the =HTML/CSS/JS that spits out to the browser as much as possible).>=20> - modularized design of functions. Re-use code. Keep it DRY, and =easy to maintain.>=20> - clear consistent code style with contexts indenting each other, so =everything is readable and easy to see the logic, easy to see any =context within the context of its parent context. Use white space and =comments well too.> - SEO-friendly URLs, so that file paths ='mysite.com/end/up/like/this.html', as opposed to ='mysite.com/end.html?up=3DT&like=3DT&this=3DT'I figured if I post the long-winded prose now, then it will be a cleaner =post later when I post the code (maybe with a video of how to use it.. =that would be fun..! Anyone have a good recommendation for cheap Mac =screen-casting software that can record videos and save into a format =that uploads onto youtube? IIRC Jing is free, but you HAVE to upload =their proprietary format onto their limited-acct. servers). Thanks for =any rec'd.-Govinda
Associated Messages, from the most recent to the oldest:
>> - MVC design will save vast amounts of maintenance headache; =separation of logic from presentation (separate the webdna from the =HTML/CSS/JS that spits out to the browser as much as possible).>=20> MVC is something I've been hearing a lot about lately.>=20> For the most part, I think in our context, we mostly could benefit =from the use of a MV system (separating the WebDNA from =controlling/viewing templates as much as possible to allow versatility =on the front end). What would be the Controller aspect?.. javascript =handlers, AJAX, Flash I suppose.>=20> Anyway, I'm curious how WebDNA'ers perceive the MVC architecture when =related to WebDNA or PHP apps.Preface for the people wondering what MVC even refers to:How many times have any of us webdna coders (esp. those who have been at =it since the mid-late 90's) been working on some legacy file that is a =mix of
Spaghetti code and intermingled webdna/html and wanted to change =what gets displayed under some circumstance.. some (presumed small) =change needed.. and you set out to make the change only to realize that =to make it work right you have to re-decipher so much more of the file's =spaghetti logic than you set out to do that session *because* the =original design (perhaps your own ;-) was not as smart as it should =have been... for one small example: you need to alter the output of some block =higher up the page, but to do that you need there a variable that does =not get created until further down the page.. and you feel the urge to =pull your own hair as you realize how much more time and brain juice =this is going to take to sort it out right. Maybe you can just move the =variable up higher.. but maybe it is not that easy.. because of the =intermingled login/presentation code.My understanding is that the:- Controller (C) part is where all the business logic decides that gets =done what will get displayed.- Model (M) part is where all the db interaction happens (whether we are =reading or writing records)- View (V) part is where we assemble the display output. Views display =static things mixed with chunks of dynamic output that were handed it by =the C (and the C may have been handed some of its data from an M)My answer to Donovan: (I decided to *show*, rather than try to =*explain*... stay tuned.. see below.)I gradually learned on my own to use functions to call blocks of code =and also to define and fill vars way at the top, and to store display =output in vars, rather than just dump content right out to output... so =that I can precisely dump to output just when and where I want, with =just the variable (e.g. [output]).And that ^^^, if done well, allows me to do a lot of separation of logic =and presentation...=20But if a file is long and complicated.. then it can still be hard (or =just long-winded) to follow the logic when it comes time to make a deep =change many months later.I learned a great deal more about making MVC work for me, by forcing =myself to use the PHP framework "Code Igniter" (as I mentioned =recently).Some part of me wishes any one who wanted to deepen their MVC practices =to learn Code Igniter, because I have had (am having) a good experience =with it... and I would like to see a similar framework to Code Igniter, =done in Webdna, as much as we can emulate it anyway without true =classes, etc..The coding style forced by Code Igniter would likely not come =intuitively at first for many webdna coders... and others here who would =try it out might feel they can combine the M and C into one space.. but =for a large project I recently learned how nice it was too keep all db =calls (M) separate from the long business logic code (C)... both of =which are also separate from the HTML/JS/CSS output (V). I would =recommend anyone who wants to pursue MVC with PHP, or in context of =trying to write a new Webdna CMS, to use Code Igniter for a project, to =learn it... but then I thought: how many here really want to learn a =whole 'nuther system... ; it is a huge time-expenditure to learn a new =system written in a different language, just to learn MVC. But when you =see it done well, then you will never forget the clarity that comes from =clear separation of logic from output. So I would recommend the =exercise, *OR* wait until one day when someone may offer their MVC =Webdna CMS here. I decided to take a stab at making a sample start to =such a framework (at least the MVC aspect to start with, if not yet the ="CMS")... and named it "WebdnaCodeSparker" ("WCS" for short). I'll =post it to the list ASAP.. probably in a couple/few days (other =responsibilities are pressing). It would be nice if others (qualified) =would like to help develop it too.. so it becomes something we all (or =many of us) might like to use. If more than a few people do say they =want to jump in, then I'll look into making a git repo so we can =collaborate. Alright? I won't have time to do more than what I'll post =here in a couple days, before a couple/few months, because of several =backup up responsibilities, so with any luck my start will be enough for =others to pick up for now. Or maybe no one will be interested? Who =knows.. Anyway I am enjoying the experiment.. as I wanted to see if I =could recreate even a few of the loads of GREAT features of Code =Igniter. I think I will have added at least the following features by =the time I post:> - MVC design will save vast amounts of maintenance headache; =separation of logic from presentation (separate the webdna from the =HTML/CSS/JS that spits out to the browser as much as possible).>=20> - modularized design of functions. Re-use code. Keep it DRY, and =easy to maintain.>=20> - clear consistent code style with contexts indenting each other, so =everything is readable and easy to see the logic, easy to see any =context within the context of its parent context. Use white space and =comments well too.> - SEO-friendly URLs, so that file paths ='mysite.com/end/up/like/this.html', as opposed to ='mysite.com/end.html?up=3DT&like=3DT&this=3DT'I figured if I post the long-winded prose now, then it will be a cleaner =post later when I post the code (maybe with a video of how to use it.. =that would be fun..! Anyone have a good recommendation for cheap Mac =screen-casting software that can record videos and save into a format =that uploads onto youtube? IIRC Jing is free, but you HAVE to upload =their proprietary format onto their limited-acct. servers). Thanks for =any rec'd.-Govinda
Govinda
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
(1997)
Return records from another (1997)
Redirect (2003)
Search-context (1999)
Extended [ConvertChars] (1997)
Aaron kant add (or whatever it was) (2000)
Core Database integration (2001)
Almost a there but..bye bye NetCloak (1997)
a * question (2003)
Upgrading to NT 4.0.1 (2000)
%@#*& back button!!! (1999)
Safari browser and WebDNA set-cookies (2003)
Does [Sendmail] create html? (2002)
WebCat2b13 Command Reference Doc error (1997)
WebCat editing, SiteGuard & SiteEdit (1997)
[lowercase] and [mixedcase] (1998)
.. more on sliding discounts... (1997)
A Show of Hands - Count WebCat Developers (2002)
Emailer error codes (1999)
Snake Bites (1997)