Coffeehouse Thread

70 posts

Questions regarding "Web pages" vs "Web forms" vs "MVC"

Back to Forum: Coffeehouse
  • User profile image
    WhatDoYou​Mean

    @kettch: "Funny you say that. Delphi pioneered some of the first drag and drop data access components that used all kinds of "invisible magic"."

    Haha YES! and here is the point: We NEVER used them. Smiley

    ps. When Delphi kind'a "died", we just moved to .NET. Was able to rewrite the controls very fast because they weren't some automagical control built-into Delphi.

  • User profile image
    kettch

    , WhatDoYouMean wrote

    @kettch: "Funny you say that. Delphi pioneered some of the first drag and drop data access components that used all kinds of "invisible magic"."

    Haha YES! and here is the point: We NEVER used them. Smiley

    ps. When Delphi kind'a "died", we just moved to .NET. Was able to rewrite the controls very fast because they weren't some automagical control built-into Delphi.

    When I'm porting an application, whether it's from something like PHP, or chicken scratches on the floor, I hardly ever look at the data access code. That kind of stuff is guaranteed to change between platforms, so it's useless. All I need to know about an application is that it manipulates data 'x'. If you've got something in the data access code that needs to be specifically ported, then you are doing it wrong.

  • User profile image
    MasterPi

    , kettch wrote

    All I need to know about an application is that it manipulates data 'x'. If you've got something in the data access code that needs to be specifically ported, then you are doing it wrong.

    +1

    Also, if you have your design documents/schema, then you should be able to reconstruct the entire application in a different framework to get identical behavior/functionality.

  • User profile image
    jongalloway

    @WhatDoYouMean: I haven't used PHP for a long time, but I'm told that many (most) professional PHP coders have been using MVC frameworks for a long time: http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller#PHP

    Ruby on Rails and other popular frameworks use MVC as well - including model binding, views, routing, etc. So if you're worried about future proofing and lock-in, MVC is likely the best thing you could be doing.

  • User profile image
    blowdart

    , WhatDoYouMean wrote

    Any sources where I can read up on how to make a custom modelbinder?

    Then again, why not just use "Request"? Isn't it easier and more stright forward specially if you want to be able to "leave" the platform and not lock yourself into this too much?

    Have you looked at web matrix? (I haven't myself, but one of the PMs over there says it's pretty much like his, no binding, no models, very php like)

     

  • User profile image
    Human​Compiler

    @blowdart:Yup, that PM is me (PM for Web Pages/Razor/MVC/etc). Definitely take a look at WebMatrix. I haven't read every single post in here, so apologies if I missed something, but why not just use PHP? Yah, I said it. Smiley

  • User profile image
    davewill

    WhatDoYouMean is trying to strike a balance between what is 100% known today and what is 100% not known in the future.  He/She is simply trying to pick the best fit for today while also hedging for the future.

  • User profile image
    Human​Compiler

    @davewill:Have to take a risk somewhere. Smiley Can't have 100% of both. Wink

  • User profile image
    kettch

    @davewill: There's nothing wrong with that. However, if you utilize good design principles, then you've already cleared away most of the obstacles to future maintenance. That said, there's no point in using any kind of stack at all if you are afraid of the very things that make it good. You should always write everything from scratch and never use anybody else's libraries.

    At that point you are actually providing a valuable service by making sure that there is plenty of material for TDWTF.

  • User profile image
    blowdart

    , davewill wrote

    He/She is simply trying to pick the best fit for today while also hedging for the future.

    I hope he/she isn't planning on ever getting married Big Smile

  • User profile image
    Bass

    ASP.NET MVC is largely open source now so it would be very hard for Microsoft to ever kill it off. Even if they loose interest, if enough MVC developers are out there using it professionally, it will still be maintained by the community around it. So while you are locked into MVC if you use it, the risk of being locked in to it is much less than if it was proprietary.

  • User profile image
    Glucose

    More than just largely open source, all MVC is open source.

    Great thread, by the way, friends.

    -Hanselman

  • User profile image
    WhatDoYou​Mean

    , davewill wrote

    WhatDoYouMean is trying to strike a balance between what is 100% known today and what is 100% not known in the future.  He/She is simply trying to pick the best fit for today while also hedging for the future.

    You said it better than I could have ever done it.

  • User profile image
    spivonious

    If you switch platforms, you're going to be rewriting a ton of code anyway.

    What you're saying sounds a lot like this:

    "Oh I won't use ADO.NET to access my data. I'll write directly to the OLE DB driver, because ADO.NET might not be in the FancyPants Framework released in 2020."

    Why reinvent the wheel? Just use what's there and assume that the next platform you move to will have something similar. The productivity gains far outweigh the loss in flexibility.

  • User profile image
    magicalclick

    @WhatDoYouMean:

    Like I said, you don't need to learn ASP.net  MVC right now. Stay with Web Pages for now. I cannot really help on how the model is created and passed in the MVC, it is quite magical indeed. Also don't use <%> anymore. Go with razor. I don't know if you need extra plugin for razor or not. I have both WebMatrix and VSExpress, and VSExpress works.

    Stay with Web Pages, because that's what you are looking for.

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified
  • User profile image
    blowdart

    , WhatDoYouMean wrote

    *snip*

    You said it better than I could have ever done it.

    OK so, go with an SOA architecture. Take the best of what's known today.

    1) Database access code these days is generally automated by ORMs and generated for you at the press of a button. .NET has ORMs, Java has ORMs, Rails has ORMs, even PHP has ORMs and the implementation of the Active Record pattern (although there's an argument that active record is a silly pattern anyway). So database access code doesn't matter.

    2) If database access code doesn't matter then you could use that as your model. It's not idea, it probably passes too much information to the web pages that they don't need though, the idea would be having a layer that turns the database models into the information that each part of your application actually needs - view models.

    3) Creation of view models from models is usually a simple object mapping, pretty easy to write. .NET has projects like automapper that take care of it for you, but if you want to write the code yourself for some reason it's usually a property to property mapping done in a constructor.

    4) If you want to plan for an unknown future the current trend is to just JSON to pass to layers, so your database feeds through to your application via a JSON layer. Again there's generators in the major languages to do this, or if you want, it's just writing out text from input.

    So yes, you could spend 6-9 months writing this stuff yourself because you want to keep yourself in a job, or because you think you're going to migrate to something else in the future. The thing is you always migrate at some point 5 years down the line. By adopting patterns and tools that aid you and remove the need to write code you're going to make your migration easier not harder, because the tools (model binding, ORMs, etc.) all exist in the major (and most minor platforms). Plus of course they're well written and well tested, so you can have confidence they work, which, to be frank, doesn't exist for a long time when you reinvent the wheel yourself.

    My smart-* marriage comment (which I borrowed from someone else, because their responses if they respond would tend to be more sane than mine ever are) still stands. Do you look at your personal relationships with the attitude of planning to get out because something better may come along in a few years? I hope not, because if you do that you aren't ever going to be happy, and you're going to spend more time looking at other options than working on and getting your current relationship/platform to work.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.