JD Vance lashes back at Zelensky after Ukraine's president claimed VP is siding with Putin
Only a third of new cars now offer a much-loved feature that experts warn will vanish by 2037
New cafe serving everything from breakfast to dinner to open in Essex village
Limited Edition of Doom Includes Game Box That, Itself, Plays Doom
Read more of this story at Slashdot.
Detail in the way you walk could put you at risk of sudden cardiac death
Morrisons introduces major change to loyalty card scheme - here's how it will impact how you spend points
'I pay a dominatrix to whip me, my wife has no idea': Tracey Cox talks to men who are too ashamed to tell their partners about their kinks
Billionaire property developer Christian Candy wins £2m stamp duty refund from HMRC after court battle with taxman over £68m Georgian mansion
Princes William and George are joined by the Duke and Duchess of Westminster to watch Aston Villa's thrilling Champions League battle against PSG - but royal fans go home disappointed after tense battle
The Nazi 'fashion house' where Jews were forced to make clothes for the rich... using fabric looted from murdered Holocaust victims
White Lotus star who complained about 'cruel' British teeth joke is ripped by SNL insiders
CodeSOD: Conventional Events
Now, I would argue that the event-driven lifecycle of ASP .Net WebForms is a bad way to design web applications. And it's telling that the model is basically dead; it seems my take is at best lukewarm, if not downright cold.
Pete inherited code from Bob, and Bob wrote an ASP .Net WebForm many many ages ago, and it's still the company's main application. Bob may not be with the company, but his presence lingers, both in the code he wrote and the fact that he commented frequently with // bob was here
Bob liked to reinvent wheels. Maybe that's why most methods he wrote were at least 500 lines long. He wrote his own localization engine, which doesn't work terribly well. What code he did write, he copy/pasted multiple times.
He was fond of this pattern:
if (SomeMethodReturningBoolean()) { return true; } else { return false; }Now, in a Web Form, you usually attach your events to parts of the page lifecycle by convention. Name a method Page_Load? It gets called when the load event fires. Page_PreRender? Yep- when the pre-render event fires. SomeField_MouseClick? You get it.
Bob didn't, or Bob didn't like coding by naming convention. Which, I'll be frank, I also don't like coding by naming convention, but it was the paradigm Web Forms favored, it's what the documentation assumed, it's what every other developer was going to expect to see.
Still, Bob had his own Bob way of doing it.
In every page he'd write code like this:
this.PreRender += this.RequestPagePreRenderThat line manually registers an event handler, which invokes the method RequestPagePreRender. And while I might object to wiring up events by convention- this is still just a convention. It's not done with any thought at all- every page has this line, even if the RequestPagePreRender method is empty.