Results 1 to 14 of 14

Thread: how to use System.Web [02/03] !?!?!?

  1. #1

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Question how to use System.Web [02/03] !?!?!?

    Greetings

    I have an interesting question to pose to you.

    I'm going to say I have a set of ready to use and tuned html generation components: System.Web.UI, System.Web.UI.WebControls, System.Web.UI.HtmlControl. In these three namespaces we have the basics for generating every html element and any xhtml element(new System.Web.UI.HtmlControls.HtmlGeneric("myXHtmlTag")) that we want, and the rest of this namespace has an awareness of the items in these namespaces. Lets call this a fact.

    I'm going to use C# because I think using a language in the same syntax as 2 out 4 (JavaScript, ActionScript, blank, Sql) other programming languages I use is a good thing.

    Code:
    using System;
    using System.Diagnostics;
    using System.Text;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    
    public namespace MyAssemblyName.Web.GUI //change is good
    {
        public sealed class WebWidget: System.Web.Control
        {
             //we need a place to render those string that is up to date
             protected overrides void Render(HtmlWriter w)
             {
                     w.Write("<!-- widget html string -->");
             }
        }
    }
    Okay, that is the way I understand you make a html element in a .net framework environment.

    So, lets say that it's just to slow..?!?!?!?!?!?!?!

    What should I do? I know I'll write my own code that is not part of the .net framework and not compliant in anyway.. I'll use StringBuilder to render all html because it is fast. And, you know it is.

    Code:
    using System;
    using System.Diagnostics;
    using System.Text;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    
    //namespaces are bad ?!?!?!?!
    public class HtmlControl
    {
         public string GetHtml()
         {
               StringBuilder ret = new StringBuilder();
               //generate string with StringBuilder
              return ret.ToString();
         }
    }
    Let us say I have a lot of these files made in the "StringBuilder" format above. Well, let us also, say there is one file with a class for every html element known to man and some that we made cause they were cool. Tab views, menus you know whatever... html, dhtml, scripts... just all kinds of stuff done all over or hard typed into into .asp files or whatever

    Do you think this would work..?

    You make new files the implement the old stuff. Then as we move on we start to:

    Code:
    using System;
    using System.Diagnostics;
    using System.Text;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    
    public namespace MyAssemblyName.Web.GUI //change is good
    {
        public sealed class WebWidget: System.Web.Control
        {
             //we need a place to render those string that is up to date
             protected overrides void Render(HtmlWriter w)
             {
                     w.Write(new HtmlControl().GetHtml());
             }
        }
    }
    For some of the more complex stuff this could get interesting as you have to introduce collections of these things and they have to maintain integrity across control depth... don't get me started on designers and vs.net eating my code or read write control designer my @$$....

    Code:
    //what I mean by compliant
    Panel content = (Panel)thePageClass.Controls.FindControl("ContentPanel");//null my @$$
    content.Controls.Clear();
    content.Controls.Add(new CoolTabClass("ThatTabGroupName_Schema_Oo"));
    Please any input, remarks, request for more explination of what I talking about... lay it on me man.
    Last edited by Magiaus; Mar 17th, 2007 at 11:24 AM. Reason: bad title
    Magiaus

    If I helped give me some points.

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724

    Re: how to use System.Web [02/03] !?!?!?

    Seems, to me, to be an unnecessary amount of work required; would you agree?

    What would the maintainability be like? Specifically, someone new comes along, and has to start working with this - what would the learning curve be to make a simple change; cost vs. coolness? And when they need to add a new cool control?

    You refer to it being to slow - ASP.NET was designed in that way; any performance issues would not be strictly related to Microsoft's code.

    One query - your examples seem to be for a page that is generated on the fly, i.e. generates the control hierarchy at run time. What about design time declarations?

  3. #3

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: how to use System.Web [02/03] !?!?!?

    Well, I am that someone new. We don't have any design time pages really. Well there may be a few and they are actually .net using System.Web.UI.Control(s)

    But, everything that really makes this "system" work is done in this other way. A lot of the code in this "system" is really good, but then they cut you off from the designers, the debugger, all the ready made items that MS gives for validation and so on. They are also defensive about it.

    Really, the reason I've posted this is to gather the opinions of others; to help me solidify my view, so that the next time, I talk to the boss about it I'll be better prepared.
    Last edited by Magiaus; Mar 17th, 2007 at 11:44 AM.
    Magiaus

    If I helped give me some points.

  4. #4

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: how to use System.Web [02/03] !?!?!?

    I'm really torn on this. But, the standing "Architects" have already gotten pissed at me about this once. They have tenure and they had to have some reason or this...

    I guess I'm asking what is more important the time it takes to fix it or the time every new guy will spend having a mental breakdown going "WHY IN THE NAME OF ALL THAT IS HOLY?" .net is too slow... "ERG?"

    "You sure it's not all those sql strings you got hard typed all over?" Stored procedures are a waste of time "URG?"

    I just nod and say "Yes, sir Mr. CrackHead!!!" ????

    A lot of programmers will say "Do what ever you are told." But, myself I think the boss would want to know both sides and make an informed choice.

    Ideas?
    Last edited by Magiaus; Mar 19th, 2007 at 11:50 AM.
    Magiaus

    If I helped give me some points.

  5. #5

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: how to use System.Web [02/03] !?!?!?

    So, is this to complex to comment on or....? Really I'm looking for input ideas and so on.
    Magiaus

    If I helped give me some points.

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: how to use System.Web [02/03] !?!?!?

    When I joined my current company, I worked on a system that was created with this very same philosophy in mind. I saw the end result of this endeavor, and to summarize this, what you are doing is essentially recreating ASP 3.0 in ASP.NET.

    When you render controls in the way you've outlined above, you are not creating anything scalable or flexible. On the contrary, changes that the system may require later will require considerably more work and more time by the developer. This is counterproductive and goes against good architectural design. It has also, in fact, rendered the .NET framework useless for your purposes, as you can go right on and do this in PHP or ASP 3.0

  7. #7

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    yep

    Yeah, that is how I see it. The worst part is that there is no good solution other than trying to slowly over time moving toward a more .net synced development process. Unfortunately, as I said in a previous post some of the "Architects" are not willing to hear reason.

    I've been talking to them about namespace resolution and inheritance. They know how to inherit and implement, but they don't use any namespaces, and don't care to ever use them. You know, MyLib.Searches.QuickSearchPage is an object/class and MyLib.Searches.SectionSpecific.QuickSearchPage, and the latter inherits from the first.

    One argument I have heard is "You’re over complicating." But, to me having a base set of rules that all my quick search pages, across all the multi sites, implement isn't over complicating it's simplification, code reuse, and just a neat idea. Especially, when all of the sites are using the same basic data set and interface.

    For instance, 80% of the quick search pages use area, zip,.... gee all I need is a base class that wil handle all those and placing them.
    Code:
    contentPNL.Controls.Add(LocationData());
    meaning there is either a UserControl, Control, or a code block that creates that form section. Then all you do in you class/page that implements the QuickSearchPage base class do your layout and onLoad you load the sets of , ready made info/parameter controls, you need into container controls and do whatever else you need to on the page.

    I guess it's a lot to take in and crunch if you are not used to working that way, but with multiple sites attempting to implement the same system it seems like a fair route to me. It may not be easy, but it's that or PHP.
    Magiaus

    If I helped give me some points.

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: how to use System.Web [02/03] !?!?!?

    Are you at a position almost level with the architects? Do you have any say in this matter?

  9. #9

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: how to use System.Web [02/03] !?!?!?

    I have say. Some of them don't want to hear what I say, but I have some level of say and my ideas are taken into consideration by the bosses. If I had a good solution->plan chances are it would be used if the head programmer didn't disagree or think it was a waste of time.
    Magiaus

    If I helped give me some points.

  10. #10
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724

    Re: how to use System.Web [02/03] !?!?!?

    Quote Originally Posted by Magiaus
    So, is this to complex to comment on or....? Really I'm looking for input ideas and so on.
    ... or on leave

    Out of interest - you state that .NET is slow; 9 times out of 10, I think you'll find it's the [custom] code that's executing that is slow.

    I do agree that one can over complicate a system, your example, however, is not one of those scenarios.

    As for these "architects" - perhaps an example would be appropriate. Draw up a relatively simple proof of concept, and execute it using both "styles".
    Log the time it takes to write it using this (as per Mendhak) ASP 3.0 style, and then using true OO methodologies.
    Load test the two styles and measure performance.

    You now have some simple graphs etc that one may present to these architects and your bosses.

    Failing all that, post it on http://worsethanfailure.com/ [used to be The Daily ***]

  11. #11

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: how to use System.Web [02/03] !?!?!?

    They certainly do a lot of things that slow down code, but then they do a lot of things to speed it up...

    For instance they read from a data reader: reader["colName"] which is slower than reader[ordinalPos]

    May sound nit picky, but that tick saved builds up over large sets of data reads.

    I can see that strictly writing pure strings could be faster than using controls for this same reason, because the code the integrates a control is by passed... but they have to be doing it themselves some how... and a well made .net control will have either a string builder back end or an optimized control creation and placement algorthym...

    It could even come down to Queue vs List if they really are doing it nit pick nano seconds or ticks...

    To speed up code thay do things like bit packing. For instance, what most would store as a rows of data, they store in a column of one row, and cut out the second table... which I honestly could live without but it does improve db hit performace for that item... but so would a cache and only 1 hit..

    I think I'm going to ask my doctor for some I don't give a **** pills and just struggle through however I can, but I really wish that all the devs could reach an agrement on what is best practice and move towards it.

    The thing is we are planning to move to 2005 soon, and I'm basicly like um why bother...
    Magiaus

    If I helped give me some points.

  12. #12
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: how to use System.Web [02/03] !?!?!?

    Quote Originally Posted by axion_sa
    ... or on leave

    Out of interest - you state that .NET is slow; 9 times out of 10, I think you'll find it's the [custom] code that's executing that is slow.

    I do agree that one can over complicate a system, your example, however, is not one of those scenarios.

    As for these "architects" - perhaps an example would be appropriate. Draw up a relatively simple proof of concept, and execute it using both "styles".
    Log the time it takes to write it using this (as per Mendhak) ASP 3.0 style, and then using true OO methodologies.
    Load test the two styles and measure performance.

    You now have some simple graphs etc that one may present to these architects and your bosses.

    Failing all that, post it on http://worsethanfailure.com/ [used to be The Daily ***]
    Axion, that link is fing brilliant. I've never seen that site before, but 'Now Hiring SQL Injectors' had me farting in my pants.

  13. #13

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: how to use System.Web [02/03] !?!?!?

    yeah, I dunno if alex would post it...
    Magiaus

    If I helped give me some points.

  14. #14

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: how to use System.Web [02/03] !?!?!?

    Well, what I'm doing now, is on a site by site basis, adding a new dll to the root projects. Which means latter it will be avaliable in the shared heap project without issue.

    The draw back is that the shared lib that is in place, as a virtual directory, has a cache (strings), and my dll has a cache (objects); so there is probably a 1-3mb of duplicated apllication memory....

    The reason I'm like why bother about VS 2005, by the way, is that next to none of the code will even display in a designer in 2005; because of "" and CSS rules and standards.... XHTML 1.0 was around years ago, but like ajax it was not realistic to use it
    Magiaus

    If I helped give me some points.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width