mercredi 29 juin 2016

Can proper OO be used with writing HTML helpers with MVC?

Can proper OO be used with writing HTML helpers with MVC? or is there a deeper reason for holding on to usage of static methods and things that can not be unit tested like TextBoxFor etc. ?

Every tutorial/book/video is using archaic procedural programming methods, on a recent project I was told not to use OO modelling and continue with writing everything in static methods and static helper functions!

Is there a real reason for every sample negating all the OO prinicples just because using helper extensions has to be done as a static method and continuing on using Text Writers line by line? Any OO modelled html components can be unit tested, more clear and concise in intention.

To make the matters worse TagBuilder is used as a mediocre text massaging utility, were as modelling with TagElements (if there was such a thing) and calling render on a parent containing child elements would render the entire DOM. Why is writing line by line is preferred instead of constructing objects that each can be programmatically accessed as specific type or IHTMLElement/ITagElement/IWathever interface?

What am I missing? This is the same method that is used to manipulate an html document loaded into a browser, except that in this case the object are being constructed and rendered into a browser. Delphi had HTML DOM object library in 1999. Why HTMLHelper promotes procedural archaic non unit testable programming?

Aucun commentaire:

Enregistrer un commentaire