|
|
How's that the same? My solution is type safe and has design time error checking
I simplified it a bit by the way.
|
|
|
|
|
It is the same in that it accomplishes the desired functionality in the app.
You were asking where to draw the line on readability and simplity. If you give a junior developer an API with .OrderBy(string) and then the one you posted, which will they understand immediately?
|
|
|
|
|
Put like that you make a good point.
The question is are you willing to trade type safety for a simple API? OrderBy(string) may be a simple function, but there's no way in telling what string values are valid and when their validity expires.
|
|
|
|
|
|
Me too, me too... Already changed the code
|
|
|
|
|
Sander: Yes, it's 'clever' code.
I have many years with Winforms, and the DataGridView. Also with building software for users, using a team of developers.
To my mind (based on your necessarily limited description) you are re-coding something that the DataGridView already does. It does it (a) more efficiently than your code, (b) with less potential for support issues (ie, bugs), and (c) in a more user-friendly manner.
If you were on my team I would see two problems. They are very common problems, so fairly straightforward to deal with.
The first problem is: Why on earth do you need to invoke the sort from a drop-down? Does the client really want to pay $10,000 to be able to sort clunky-fashion, instead of just click the damn header like every other right-thinking user?
Go back to the user and enlighten them on what they really want to do here.
The second problem is: You (the developer) have decided (as developers often do) to code your way out of a corner. You develop code that must be laboriously explained (although it is excitingly generic). Then you post the code on a geeky forum, looking for approval. I know why you've done that: because you know there are other guys on your team who will diss your 'clever' code.
Pro tip: you are writing Winforms apps for end users. You have not yet been called to write cross-platform compilers for GoogIntelSoft.
As your boss I would tell you: "Sander, when we deliver that software (next week BTW), our client will not pay us one red cent extra for the cleverness of your grid sorting code. Any bugs it generates in the approval period will cost me money."
|
|
|
|
|
Robert g Blair wrote: something that the DataGridView already does I have had this problem before and sorting a DataGridView is somehow a very difficult task when you're not using DataViews...
Robert g Blair wrote: Why on earth do you need to invoke the sort from a drop-down? Because it's much easier than sorting the DataGridView without a DataView (why is this so hard anyway?).
Robert g Blair wrote: Then you post the code on a geeky forum, looking for approval Actually I don't. I was expecting this to fail the 'clever'-test. But where does real clever become 'clever'? That I wonder. And I wondered that when writing the code. It does everything I need and it does it well (better than the DataGridView which is still impossible to sort...), but no mortal is ever going to figure out those generics (well, so to speak, I'm not that clever ).
I'm no newbie looking for approval. In fact I don't think the people who know me question my professionalism or my 'cleverness' (although they do, from time to time, question my sanity)
Robert g Blair wrote: there are other guys on your team who will diss your 'clever' code Actually they were quite impressed I could concoct such a piece of unreadable, yet compiling, code
I did already make the code a bit simpler.
Robert g Blair wrote: As your boss I would tell you: "Sander, when we deliver that software (next week BTW), our client will not pay us one red cent extra for the cleverness of your grid sorting code. Any bugs it generates in the approval period will cost me money." Actually we're being paid by the hour
That isn't to say I'm not doing my best or working my fastest. Our clients are programmers too and they will check out my code.
I'm professional and practical enough to know when to stop working on a 'clever' solution and look for another solution.
This solution here cost me about 15-30 minutes, which is infinitely faster than sorting the DataGridView without a DataView.
If only it were actually easy to out-of-the-box sort that DataGridView...
I still wake up at night, sweating, screaming "InvalidOperationException! The DataSource does not support sorting!" (or something like that)...
|
|
|
|
|
What a pleasure to read this kind of thoughtful analysis !
thanks, Bill
«To kill an error's as good a service, sometimes better than, establishing new truth or fact.» Charles Darwin in "Prospero's Precepts"
|
|
|
|
|
Robert g Blair wrote: instead of just click the damn header
How do I have it sort by column 5 then by column 7 descending?
Clicking on column headers to sort is bullshit and whoever started it should be shot.
|
|
|
|
|
using(Rant rant = new Rant(RantMode.On))
{
A few years ago I stopped getting the newspaper delivered because I usually peruse the news sites when I get to work in the am. It used to be where you could go to CNN.com, NBC.com, MSNBC.com, LATimes.com, NYTimes.com, etc, and actually READ articles. I enjoyed stating my day with thinking through the news articles.
Now, they're mostly pages of video links. MSNBC.com has different sections, and stories often appear in 2 or even 3 sections - just to fill the page. It's mind numbing and doesn't really make you pause and think.
NBC.com and CNN.com are just as ridiculous with large images that often link to videos.
LA and NY times sites are less of a mess, but still contain mostly videos.
In all cases it takes FOOOOOOREEEEVVVVERRR for these pages to load because they're pulling all these images. Clicking one takes FOOOOOOREEEEVVVVERRR to load because they go get the clip. And I have a fast machine.
Then, the clips all start with 30 second ads for stupid stuff I don't care about. Then the video's actual content is often a 30 second blurb from a reporter with no real content about what's actually happening
Sometimes there's text associated with the "story", sometimes it's just the vid. Sometimes the vid doesn't load at all, so if I want to read (hear) about the story, I have to go to another site.
Me thinks I'm going to order the paper again. If I want to watch vids, I'll go to Netflix.
}
If it's not broken, fix it until it is
|
|
|
|
|
I like the BBC [^] even though they are a little bit leftie and biased they still report the news rather than droning on about their own view of the world.
|
|
|
|
|
This is my point exactly![^]
Instead of just showing me the TEXT of the article, I get this $hit.
If it's not broken, fix it until it is
|
|
|
|
|
It's a way of paying for the service. If it's subscription free then they need to sell advertising space. Would your company provide its services at no cost to the consumer?
|
|
|
|
|
Spot on! The sad thing is that this seems to be the norm these days. My brother in-law needs me to take a look at his 3 year old laptop...again...because he says it's really slow loading web pages. I suspect most of his issues are related to the practices you described. I have seen talk here in the lounge of a way to stop videos and crap from loading. Anyone?
"Go forth into the source" - Neal Morse
|
|
|
|
|
Can't we just unplug the interweb?
If it's not broken, fix it until it is
|
|
|
|
|
I use adblock[^] which stops quite a bit of crap from loading.
|
|
|
|
|
|
Interesting. I have used that approach in the past - not really sure why I stopped.
Anyway,
|
|
|
|
|
kmoorevs wrote: I have seen talk here in the lounge of a way to stop videos and crap from loading. Anyone? Blocking via the the Hosts-File, maybe? http://winhelp2002.mvps.org/hosts.htm[^]
I did that after somebody mentioned it here and replaced Adblock with that. Works quite well.
|
|
|
|
|
I switched to uBlock with the hosts file and I'm quite satisfied!
Hogan
|
|
|
|
|
Yahoo News now has this REALLY crappy endless vertical layout where articles are 1) repeated endlessly and 2) mixed in with fake "sponsored" articles. Then if you open an article in a new tab you'll find that the endless vertical list of articles (usually in a different order) is repeated at the end of the article you just read.
Looks like the folks at ESPN just copied much of Yahoo News' format.
Contrary to popular belief, nobody owes you anything.
|
|
|
|
|
Start with downloading the MVPS-hostfile and update your own hostfile. You don't even want to block that crap from displaying, you want it to not download in the first place.
As for what is "news", I'd guess that our definitions vary. I don't need the mainstream opinion on yesterday's news - today's facts will be fine.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Kevin Marois wrote: NBC.com and CNN.com are just as ridiculous with large images that often link to videos. And I have to disable my hosts file for those videos to work (thanks to the embedded ads).
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
It's working, then.
They're getting you to open a huge number of pages, and therefore register an even more huge number of ad "views".
Remember the Golden Rule: If it's free for you to use, your actions become the source of income.
Some of us were bitching talking about how companies would pervert everything to make money out of us on-line before the marketing and advertising people even started turning 93% of the web into bollocks.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|