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. :)
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!
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).
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.
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..
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).
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.
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.
Comment preview
Comments have been closed on this topic.
Markdown formatting
ESC to close
Markdown turns plain text formatting into fancy HTML formatting.
Phrase Emphasis
*italic* **bold**
_italic_ __bold__
Links
Inline:
An [example](http://url.com/ "Title")
Reference-style labels (titles are optional):
An [example][id]. Then, anywhere
else in the doc, define the link:
[id]: http://example.com/ "Title"
> Email-style angle brackets
> are used for blockquotes.
> > And, they can be nested.
> #### Headers in blockquotes
>
> * You can quote a list.
> * Etc.
Horizontal Rules
Three or more dashes or asterisks:
---
* * *
- - - -
Manual Line Breaks
End a line with two or more spaces:
Roses are red,
Violets are blue.
Fenced Code Blocks
Code blocks delimited by 3 or more backticks or tildas:
```
This is a preformatted
code block
```
Header IDs
Set the id of headings with {#<id>} at end of heading line:
## My Heading {#myheading}
Tables
Fruit |Color
---------|----------
Apples |Red
Pears |Green
Bananas |Yellow
Definition Lists
Term 1
: Definition 1
Term 2
: Definition 2
Footnotes
Body text with a footnote [^1]
[^1]: Footnote text here
Abbreviations
MDD <- will have title
*[MDD]: MarkdownDeep
FUTURE POSTS
Partial writes, IO_Uring and safety - about one day from now
Configuration values & Escape hatches - 4 days from now
What happens when a sparse file allocation fails? - 6 days from now
NTFS has an emergency stash of disk space - 8 days from now
Challenge: Giving file system developer ulcer - 11 days from now
And 4 more posts are pending...
There are posts all the way to Feb 17, 2025
RECENT SERIES
Challenge
(77): 20 Jan 2025 - What does this code do?
Answer
(13): 22 Jan 2025 - What does this code do?
Comments
Buggrit!
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 <texbox>
;)
Ack, blog ate my HTML, or rather, didn't eat my HTML... should that be HtmlEncoded?
WebForms, I do so hate thee...
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. :)
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!
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).
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.
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.
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..
I am calling YAGNI on this code. Why do users even need to login?
Nobody doubts this works, but it's brutal.
I smell duct tape
I like it!
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).
I'm really interested to see where this takes you as your application evolves. I presume you're still writing tests.
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
Chris,
Your parallels are quite mistaken
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.
Comment preview