views:

526

answers:

3

I need a simple server-side scripting solution for the following problem: My client has me making a site in ASP.NET MVC. I'm coding the whole site but there's a section they want to be able to expand later via simple scripting. For example:

When is your birthday?
__/__/____  [x] Don't display the year

This needs to take a title (When is your Birthday?), a date, a way to indicate that a checkbox is needed, and a text for the checkbox. That's all simple markup. The final need is a conditional for whether or not to display the birth year. When displaying this information later.

I considered using JavaScript as my scripting language and just running it client-side. Although this works for the trivial example above, some of the real-world information is too sensitive to have so easily seen as can be done in JavaScript. I'd rather all the data be processed server-side.

+2  A: 

If your client has someone smart enough to do this with JavaScript, then why couldn't that person learn enough C# (or VB.NET?) to simply edit the views and controllers directly?

Building your app with the extra complexity of some embedded scripting language or plugin architecture seems like overkill and would probably make it harder to maintain by someone who did know C# and came along to make these simple changes as needed.

I'm trying to say that C# or VB.NET are pretty good server side languages, so why look for something else?

Dennis Palmer
+2  A: 

I'd echo Dennis' answer, and add that they might want to consider using SharePoint (WSS 3.0) for that part of the web site. It's built on ASP.NET and Windows Workflow Foundation, so it's not some foreign technology.

On the other hand, it's built to be extended by persons with little or no programming background. Modifications can be made using the SharePoint UI, or using Microsoft Office SharePoint Designer, which is now free.

That should be more than enough power for them, and all without having to over-generalize your site in order to accommodate vague requirements.

John Saunders
+1  A: 

That is defined enough that you probably don't need hideously complex stuff like sharepoint or WWF, just a little object-foo. From your description of the requirements you'd need:

1) Facilities to store these "DateOptionFields" which could presumably track back to a user record. Again, from your description of the problem, you are looking at 6 or so fields: QuestionType, QuestionTitle, CheckedTrue, DateSupplied and ShouldShowYear as well as some identifier.

2) Facilities to manage these extra questions--really depends on the app and the requirements. Gets a bit stickier if the "extra" questions don't apply to all users, but generally not too sticky.

Then jack the "extra" questions into the UI at appropriate places for appropriate users and you are done.

Wyatt Barnett
6 extra fields for "DateOptionFields", which was described as the trivial example! How many extra fields do you need for other presumably unknown field/option types that the client will want to add? There are CMS systems that will do this type of thing, but to build it into a new app seems like a lot of work and would be harder to maintain in the long run.
Dennis Palmer
I am wholly going off the OP's question--he hints it is trivial, but he indicates that the triviality deals with security, not with the data he is tracking. Not that I don't disagree with the general idea that trying to reinvent the wheel with a DSL of some sort in your app isn't the best idea. Now, if you get yourself into one of those dynamic system situations, I would recommend skipping extra fields and moving to XML payloads. Much more flexible and you get out of the DBA business.
Wyatt Barnett