Ayende @ Rahien

It's a girl

YAGNI, I told them, millennium hand and shrimp!

I am running a long experiment with myself to see whatever you are gonna need YAGNI.

So I went way back to this:

image

And this:

image

This is an application that I am explicitly growing organically, only adding things as I really need them. It is working so far.

Comments

Graham
10/27/2009 11:00 AM by
Graham

Buggrit!

Barry Dahlberg
10/27/2009 11:41 AM by
Barry Dahlberg

Gee if you had those all in custom controls you'd be able to make one change to fix all your labels so they are associated with their text boxes...

<labelPass

;)

Barry Dahlberg
10/27/2009 11:44 AM by
Barry Dahlberg

Ack, blog ate my HTML, or rather, didn't eat my HTML... should that be HtmlEncoded?

James L
10/27/2009 12:21 PM by
James L

WebForms, I do so hate thee...

Chris Cyvas
10/27/2009 12:34 PM by
Chris Cyvas

Your webform brings all the boys to the yard! ;)

I think the hipster coders might knock a few points off your "cool" factor for displaying such an antiquated technology. At least, that's what they would say. :)

zvolkov
10/27/2009 01:11 PM by
zvolkov

Postbacks? Oh no! Even back in 2000 with classic ASP I always did command/query separation (or controller/view separation). View pages posted their forms to controller pages and controller pages redirected to view pages. You can do webforms but no posbacks for Christ sake!

Ryan Riley
10/27/2009 01:32 PM by
Ryan Riley

If you are pulling YAGNI, why are you starting with ASP.NET? Why not start with your HTML? After all, ASP.NET is producing HTML forms, which are really just documents with a designated action attribute for processing (which is also optional). So you could in fact just have the form and then create an ASP or ASP.NET page for the processing, then redirect. Or use CGI and really go caveman style. :)

Seriously, though, how did you decide that classic WebForms was YAGNI? On what were you calling YAGNI? MVC? If so, I don't follow the logic as those are two different approaches to achieving the same thing. If you had called YAGNI on ASP.NET in favor of ASP, I would understand (and possibly agree).

Paul
10/27/2009 02:07 PM by
Paul

What is this strange MasterPageFile you speak of? All looks a bit new and technical to me :)

Fair play man. If it doesn't change too much and isn't causing sleepless nights, roll with it.

Bradley Landis
10/27/2009 02:23 PM by
Bradley Landis

zvolkov,

Wouldn't having controller pages and view pages right from the get go defeat the point of the experient. You Aren't Going To Need It! I think ayende is saying, he will gladly refactor to something like that when the need arises, he is just waiting for the need to arise.

Andrew
10/27/2009 04:49 PM by
Andrew

I know we all hate Web Forms, but really, we don't even know what this project/application is meant to do. If it's 3 web pages that show a grid with a few text boxes, Web Forms will be just fine..

Phil
10/27/2009 05:42 PM by
Phil

I am calling YAGNI on this code. Why do users even need to login?

Frank Quednau
10/27/2009 06:23 PM by
Frank Quednau

Nobody doubts this works, but it's brutal.

gunteman
10/27/2009 08:07 PM by
gunteman

I like it!

Tobin Harris
10/28/2009 12:32 AM by
Tobin Harris

I like it too, beginners mindset in action. Also better than the 350+ LOC that comes with MVC AccountController (assuming userService isn't a refactoring of that).

Jason Stangroome
10/29/2009 02:55 AM by
Jason Stangroome

I'm really interested to see where this takes you as your application evolves. I presume you're still writing tests.

Chris Smith
10/31/2009 10:52 PM by
Chris Smith

If it works, does it matter? I've released a few things built this way and I've never had any trouble. I mean BIG things which have over a million hits a day.

Don't forget:

ViewState == ViewData

Code behind == Controller

Ayende Rahien
11/01/2009 03:10 AM by
Ayende Rahien

Chris,

Your parallels are quite mistaken

Chris Smith
11/01/2009 11:10 AM by
Chris Smith

I don't think there is a stable definition of MVC in a web context which we can build on. It means different things to different people. Ok slight clarification on my point..

View State <= ViewData. ViewData is actually greater than View State. You have to pass the state via View Data to the view. ASP.Net provides a black box abstraction for this and persists it automatically between requests. The concepts are equivalent and you do spend a lot of time building ASP.Net on top of ASP.Net MVC.

Code behind == Controller. Each is responsibly for managing UI state and interaction with the model. ASP.Net MVC uses request data for state management (you manually recover state). ASP.Net web forms manages state for you.

Same generalised concepts, different application.

MVC is so blurred, it's impossible to take sides.

Comments have been closed on this topic.