March 10, 2012
On Fri, Mar 09, 2012 at 09:06:40PM -0800, Andrei Alexandrescu wrote: [...]
> Insert obligatory link: http://drdobbs.com/184401197
> 
> Very insightful article.
[...]

Wow. That's quite an interesting read, especially since it goes against conventional wisdom that non-member non-friend functions are "bad".

But I see why this totally makes sense. Recently I looked up David Parnas' revolutionary paper about information hiding (the paper that started it all), from which it's very clear that the basic motivation behind encapsulation is resilience in the face of inevitable change. So the article linked above totally makes sense. Breaking changes tend to happen inside a class, so if something doesn't *need* access to private members, then it doesn't, and shouldn't, need to be a class member.

In retrospect, I do find myself frequently factorizing code *within* a class such that most member functions don't actually need direct access to private members, or if they do, they use as few private members as possible to do what they need to do. So by Dr. Dobbs' standard, most of these member functions ought to be external to the class proper.

This is where UFCS really shines... now I *can* actually move these members out of the class, and it doesn't even change the class API! Plus, *users* can add new pseudo-members and it extensibly enhances the class API while retaining that resilience to change.

D is getting more awesome by the day. Now I truly can't convince myself to go back to C++!


T

-- 
There are two ways to write error-free programs; only the third one works.
March 10, 2012
On 2012-03-10 08:18, Nick Sabalausky wrote:
> "Andrei Alexandrescu"<SeeWebsiteForEmail@erdani.org>  wrote in message
> news:jjengv$agm$1@digitalmars.com...
>>
>> Insert obligatory link: http://drdobbs.com/184401197
>>
>> Very insightful article.
>>
>
> Jesus christ what the FUCK is wrong with Dr Dobbs? The article shows up
> *just fine* - *at first*, and then once all the excess junk around the edges
> finishes loading, the stupid fucking thing redirects me (WITH NO BACK
> BUTTON!) to this useless shit: http://m.drdobbs.com/
>
> What the fuck is wrong with web developers? You'd think at a
> ***PROGRAMMING*** MAGAZINE they could fucking get basic shit straight
> without scrwing up things that a NOVICE wouldn't even KNOW how to fuck up!
> Goddamn.
>
> It sounds like a great article, judging by the first paragraph, but I have
> to read it a couple sentences at a time. How the hell do "professions" botch
> things up *that* badly?

Happens to me as well. Mac OS X, Firefox 10.0.2, JavaScript turned off by default.

-- 
/Jacob Carlborg
March 10, 2012
"Jacob Carlborg" <doob@me.com> wrote in message news:jjg2ts$2roo$2@digitalmars.com...
> On 2012-03-10 08:18, Nick Sabalausky wrote:
>> "Andrei Alexandrescu"<SeeWebsiteForEmail@erdani.org>  wrote in message news:jjengv$agm$1@digitalmars.com...
>>>
>>> Insert obligatory link: http://drdobbs.com/184401197
>>>
>>> Very insightful article.
>>>
>>
>> Jesus christ what the FUCK is wrong with Dr Dobbs? The article shows up
>> *just fine* - *at first*, and then once all the excess junk around the
>> edges
>> finishes loading, the stupid fucking thing redirects me (WITH NO BACK
>> BUTTON!) to this useless shit: http://m.drdobbs.com/
>>
>> What the fuck is wrong with web developers? You'd think at a
>> ***PROGRAMMING*** MAGAZINE they could fucking get basic shit straight
>> without scrwing up things that a NOVICE wouldn't even KNOW how to fuck
>> up!
>> Goddamn.
>>
>> It sounds like a great article, judging by the first paragraph, but I
>> have
>> to read it a couple sentences at a time. How the hell do "professions"
>> botch
>> things up *that* badly?
>
> Happens to me as well. Mac OS X, Firefox 10.0.2, JavaScript turned off by default.
>

You know what I think it is (without actually looking at the code): I think they tried to do some highly misguided and even more poorly implemented hack (which they no-doubt thought was clever) for dealing with *cough* "old" *cough* browsers by inserting a meta redirect to a hardcoded URL, and then used JS to disable the meta redirect. If that's the case, I don't know how the fuck they managed to convince themselves that make one drop of sense.

When I used one of my web developer plugins to disable meta redirects, the screwy behavior stopped. And like you, I have JS off by default (WTF do you need JS for on a goddamn *ARTICLE*?). So that's probably what the numbnuts over at Dr Dobbs did.


March 10, 2012
"H. S. Teoh" <hsteoh@quickfur.ath.cx> wrote in message news:mailman.412.1331398464.4860.digitalmars-d@puremagic.com...
>
> Breaking changes tend to
> happen inside a class, so if something doesn't *need* access to private
> members, then it doesn't, and shouldn't, need to be a class member.
>

Unless they need polymorphism :(

> In retrospect, I do find myself frequently factorizing code *within* a class such that most member functions don't actually need direct access to private members, or if they do, they use as few private members as possible to do what they need to do. So by Dr. Dobbs' standard, most of these member functions ought to be external to the class proper.
>
> This is where UFCS really shines... now I *can* actually move these members out of the class, and it doesn't even change the class API! Plus, *users* can add new pseudo-members and it extensibly enhances the class API while retaining that resilience to change.
>

It also has the benefit of shrinking the vtables of each instance. (Although I think 'final' might have the same effect if used the same way?)

> D is getting more awesome by the day. Now I truly can't convince myself to go back to C++!
>

Totally. But I had given up on C++ ten years ago. Unfortunately, as I may be getting into some iOS/Android game dev soon (likely with Marmalade, since Corona looks to be little more than a shiny overpriced toy - just like its older brother Flash), I may need to start using C++ again. Ugh. I love game dev, but I'm not looking forward to that aspect of it. Mature Arm support for D can't come soon enough! If there were a date, I'd be counting the days.

> There are two ways to write error-free programs; only the third one works.

Heh, once again, a gem. I also laughed out loud at the "That phone number is imaginary, rotate your phone 90 degrees and try again".



March 10, 2012
On Saturday, March 10, 2012 14:41:53 Nick Sabalausky wrote:
> You know what I think it is (without actually looking at the code): I think they tried to do some highly misguided and even more poorly implemented hack (which they no-doubt thought was clever) for dealing with *cough* "old" *cough* browsers by inserting a meta redirect to a hardcoded URL, and then used JS to disable the meta redirect. If that's the case, I don't know how the fuck they managed to convince themselves that make one drop of sense.
> 
> When I used one of my web developer plugins to disable meta redirects, the screwy behavior stopped. And like you, I have JS off by default (WTF do you need JS for on a goddamn *ARTICLE*?). So that's probably what the numbnuts over at Dr Dobbs did.

Well, much as _you_ hate JS, many people don't turn it off, because regardless of how good or bad it is, enough relies on it that many would consider it too unpleasant to try and use the web with it off. And if everyone's using it, then there's no reason _not_ to use JS if you think that it best solves what you're trying to do.

Now, normally I wouldn't think that you'd need JS for article, and their particular solution may have been a bad one, but it's not like it's uncommon for web developers to just assume that you're going to have JS enabled. I would think that you'd be running into problems like that all the time with the esoteric web browsing setup that you have.

- Jonathan M Davis
March 10, 2012
On Sat, Mar 10, 2012 at 02:41:53PM -0500, Nick Sabalausky wrote: [...]
> You know what I think it is (without actually looking at the code): I think they tried to do some highly misguided and even more poorly implemented hack (which they no-doubt thought was clever) for dealing with *cough* "old" *cough* browsers by inserting a meta redirect to a hardcoded URL, and then used JS to disable the meta redirect. If that's the case, I don't know how the fuck they managed to convince themselves that make one drop of sense.
> 
> When I used one of my web developer plugins to disable meta redirects, the screwy behavior stopped. And like you, I have JS off by default (WTF do you need JS for on a goddamn *ARTICLE*?). So that's probably what the numbnuts over at Dr Dobbs did.
[...]

I've always believed that Javascript is the hellspawn of evil incarnate.

Last year when at my day job a large-scale Javascript project was dumped on my lap, I spent 1/2 a week's time to update myself on the language (as well as understand that morass of lasagna code I had to work with), and I discovered that Javascript has some really neat features, like closures (that's why I find D's delegates so immensely useful), and that overall, it's a not-bad language for doing neat stuff in. Especially if you use jQuery, which almost feels like it belongs in the Javascript spec.

I still believe that Javascript is the hellspawn of evil incarnate.

The web was originally a pull medium: you want to lookup a resource, you send a request, the server returns a document. Nowhere in this picture is interactivity. Oh, did they tried to make it more interactive. Cookies, sessions, and what not, it's all an effort to make a stateless HTTP protocol "feel" like it's interactive. The marketroids loved push media.  They wanted more 'push' on the web. Then somebody came up with the idea of running script snippets on the browser instead of the server. So Javascript was born.

I've always believed that Javascript is the hellspawn of evil incarnate.

Having arbitrary Turing-complete code run on your browser just because you asked the server "please send me resource X" is, shall we say, a security concern? So they came up with the whole XSS thing to try to contain the beast, along with various other kludges to try to patch various problems that came up, and then patch the problems that the patches introduced, ad nauseum.

But Javascript is still the hellspawn of evil incarnate.

Git-pull a couple o' years, and here we are today with a web that's increasingly interactive, and Javascript is an essential part of it. Whether or not that's a good thing, public opinion is generally positive. Heck, I myself wrote an application in Javascript, actually *two*, just because tools have developed to make it so *easy*.

I still believe that Javascript is the hellspawn of evil incarnate.

In fact, it's so easy that everybody and his neighbor's dog writes Javascript on their website. Even if the website is essentially nothing but a bunch of articles. Resources that you look up by sending a request to a server and getting a document in return. Like the good ole days when the web was a pull medium. Except now almost everything comes with Javascript, even when it's not needed. And because it's so pervasive, it's only a matter of time before somebody gets this bright idea that whoever browses the web *without* Javascript must be certainly be using an ancient dilapidated browser from before the dinosaurs walked the earth.

So you see, Javascript is the hellspawn of evil incarnate. :-)


T

-- 
If creativity is stifled by rigid discipline, then it is not true creativity.
March 10, 2012
On Sat, Mar 10, 2012 at 02:56:00PM -0500, Nick Sabalausky wrote:
> "H. S. Teoh" <hsteoh@quickfur.ath.cx> wrote in message news:mailman.412.1331398464.4860.digitalmars-d@puremagic.com...
> >
> > Breaking changes tend to happen inside a class, so if something doesn't *need* access to private members, then it doesn't, and shouldn't, need to be a class member.
> >
> 
> Unless they need polymorphism :(

True.

Every now and then I still mull over how to reconcile class hierarchies with generic programming. I mean, inheritance and polymorphism are definitely very powerful concepts, but once you throw templates into the mix, the two don't quite get along very well (they try to, but every now and then they get into a fight). I mean, conceptually speaking, templated members should be polymorphic too, but then it's impossible to implement in code.

Really makes me wonder if there's something out there, some brand new unifying concept, that can marry the two and retain their best characteristics. Or perhaps a revolutionary new concept that replaces inheritance and templates with something even more powerful.


> > In retrospect, I do find myself frequently factorizing code *within* a class such that most member functions don't actually need direct access to private members, or if they do, they use as few private members as possible to do what they need to do. So by Dr. Dobbs' standard, most of these member functions ought to be external to the class proper.
> >
> > This is where UFCS really shines... now I *can* actually move these members out of the class, and it doesn't even change the class API! Plus, *users* can add new pseudo-members and it extensibly enhances the class API while retaining that resilience to change.
> >
> 
> It also has the benefit of shrinking the vtables of each instance. (Although I think 'final' might have the same effect if used the same way?)

I don't know about that, what if it's a final override? (Or is that
illegal in D?)


> > D is getting more awesome by the day. Now I truly can't convince myself to go back to C++!
> >
> 
> Totally. But I had given up on C++ ten years ago. Unfortunately, as I may be getting into some iOS/Android game dev soon (likely with Marmalade, since Corona looks to be little more than a shiny overpriced toy - just like its older brother Flash), I may need to start using C++ again. Ugh. I love game dev, but I'm not looking forward to that aspect of it. Mature Arm support for D can't come soon enough! If there were a date, I'd be counting the days.

When I picked up D, one of my hopes was to use it for game dev. I had just started an SDL project in C++, but later decided to abort it in favor of D. Sadly, the current implementation of D still has some wrinkles to be straightened out before it's usable for real game dev. :-(


> > There are two ways to write error-free programs; only the third one works.
> 
> Heh, once again, a gem. I also laughed out loud at the "That phone number is imaginary, rotate your phone 90 degrees and try again".
[...]

One of the ones that made me LOL when I first heard it was:

	I am Ohm of Borg. Resistance is voltage over current.

:-)


T

-- 
Famous last words: I wonder what will happen if I do *this*...
March 10, 2012
 "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message
news:mailman.433.1331409882.4860.digitalmars-d@puremagic.com...
> On Saturday, March 10, 2012 14:41:53 Nick Sabalausky wrote:
>> You know what I think it is (without actually looking at the code): I
>> think
>> they tried to do some highly misguided and even more poorly implemented
>> hack
>> (which they no-doubt thought was clever) for dealing with *cough* "old"
>> *cough* browsers by inserting a meta redirect to a hardcoded URL, and
>> then
>> used JS to disable the meta redirect. If that's the case, I don't know
>> how
>> the fuck they managed to convince themselves that make one drop of sense.
>>
>> When I used one of my web developer plugins to disable meta redirects,
>> the
>> screwy behavior stopped. And like you, I have JS off by default (WTF do
>> you
>> need JS for on a goddamn *ARTICLE*?). So that's probably what the
>> numbnuts
>> over at Dr Dobbs did.
>
> Well, much as _you_ hate JS, many people don't turn it off, because
> regardless
> of how good or bad it is, enough relies on it that many would consider it
> too
> unpleasant to try and use the web with it off. And if everyone's using it,
> then
> there's no reason _not_ to use JS if you think that it best solves what
> you're
> trying to do.
>

"Everyone" *isn't* using it (even for a non-literal usage of "everyone"). And I have it turned off because the web is not *not only* "unpleasant" with it *on*, but, for me, borderline unusable.

> Now, normally I wouldn't think that you'd need JS for article, and their
> particular solution may have been a bad one, but it's not like it's
> uncommon
> for web developers

"Common" and "not stupid" are *very* different things. You're making a patently false assumption that the former implies the latter.

> I would think that you'd be running into problems like that all the time
> with
> the esoteric web browsing setup that you have.
>

It may seem that way, but it's *much* less trouble then what I had before I blocked flash (with NoScript), installed AdBlock Plus, and disabled JS (also with NoScript). Seriously. No exaggeration. I literally *cannot* read a page when there's shit animating around it. You can? Other people can? Most people can? I don't give a fuck. Good for you.

Seriosuly, don't even think of using a "*most* people aren't like that" argument. Every goddamn thing about me is outside of the holy, sacred motherfucking "bell curve of relevence" (Ie: "If you're outside the bell cure, you're not relevent"), and has been for my whole goddamn life.

No more. These days, *anyone* who pulls any sort "common case vs exceptional case" bullshit excuse around me, for anything, can go fuck themselves.

"Join us! Be just like us! Submit! Conform!" <-- fuck the goddamn idiot sheep


March 10, 2012
On 3/10/12, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:
> I've always believed that Javascript is the hellspawn of evil incarnate.

You and Nick just became best friends! :P
March 11, 2012
On Sat, Mar 10, 2012 at 05:45:33PM -0500, Nick Sabalausky wrote:
>  "Jonathan M Davis" <jmdavisProg@gmx.com> wrote in message
> news:mailman.433.1331409882.4860.digitalmars-d@puremagic.com...
[...]
> > Well, much as _you_ hate JS, many people don't turn it off, because regardless of how good or bad it is, enough relies on it that many would consider it too unpleasant to try and use the web with it off. And if everyone's using it, then there's no reason _not_ to use JS if you think that it best solves what you're trying to do.

The problem is not what JS solves, per se, but the fact that many web developers use it for no good reason at all besides the fact that it's the "cool new thing".


[...]
> "Everyone" *isn't* using it (even for a non-literal usage of "everyone").  And I have it turned off because the web is not *not only* "unpleasant" with it *on*, but, for me, borderline unusable.

I used to do that. :-)

These days, I just can't be bothered what someone does or doesn't do with JS on their site.  Opera lets me configure scripting on a per-site basis. As soon as I run into a site that uses annoying scripting, it's bye-bye scripting for that site forever.

In the past, I've even used UserJS to *edit* the site's JS on the fly to rewrite stupid JS code (like replace sniffBrowser() with a function that returns true, bwahahaha) while leaving the rest of the site functional. I do not merely hate Javascript, I fight it, kill it, and twist it to my own sinister ends.  >:-)


[...]
> > I would think that you'd be running into problems like that all the time with the esoteric web browsing setup that you have.

Esoteric?! Really? Whatever happened to those days of graceful degradation?  Or are we sliding back into the bad ole days of gratuitous incompatibilities? And here I was, thinking that the W3C was attempting to make things interoperate...


> It may seem that way, but it's *much* less trouble then what I had before I blocked flash (with NoScript), installed AdBlock Plus, and disabled JS (also with NoScript). Seriously. No exaggeration. I literally *cannot* read a page when there's shit animating around it.
[...]

Opera has content blocking. :-) It's configurable per-site, even. I actively use it on sites where things flash around for no good reason. OTOH, when >50% of a site is just random animated junk, I just leave and never return, 'cos whoever runs the site obviously doesn't have anything useful to offer me anyway. It's a pretty reliable indicator of site quality, actually. And of whether I want to bother giving it another second of my time.


T

-- 
"640K ought to be enough" -- Bill G., 1984. "The Internet is not a primary goal for PC usage" -- Bill G., 1995. "Linux has no impact on Microsoft's strategy" -- Bill G., 1999.