Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror

Comment: Re:Poor Alan Kay (Score 1) 192

by lgw (#48918683) Attached to: Bjarne Stroustrup Awarded 2015 Dahl-Nygaard Prize

Without exceptions, you would put in an assertion

Oh? You check for errors in code that gets #ifdef-ed out in a production build? What could possibly go wrong with that plan? (Or do you mean first the check, then the assert, following every function call, further hiding the few lines of business logic in a huge function).

It's quite easy to write "all exception safe all the time" code in C++, in ways that even the junior guys can't screw up. It's not obvious what that coding standard looks like. That's the big problem with C++. Many have never even seen it done right - it's very understandable why business largely moved to managed code.

People see RAII and think "oh, instead of allocate at the top and free at the bottom, I'll allocate in the constructor and free in the destructor". No, you're still doing it wrong if you have any non-trivial destructors outside of a bit of well-reviewed library code.

If you're doing it right, the only avenues for screwing up resource management are adding stuff to a global object and forgetting it there, as with every language.

Comment: Re:DVD (Score 1) 233

by lgw (#48917749) Attached to: Ask Slashdot: Best Medium For Personal Archive?

The cloud makes a great backup. If what you're archiving is small, encrypt it and upload it to a variety of cloud file companies with free offerings - Cloud Drive, OneDrive, DropBox, etc.

For a moderate amount of data, use (encryption and) Amazon Glacier. If you don't know the trick: Amazon offers mail us a hard drive as an upload format for S3 and Glacier, and it's as good as way to do offsite backups as any.

I wouldn't use the cloud as my only archive, but as the offsite copy it's probably more disaster-survivable than most other choices most of us have available. (And affordable if we're talking a few hundred GB of personal stuff, not the entire multi-TB geek archive of "binaries").

Comment: Re:Poor Alan Kay (Score 1) 192

by lgw (#48914793) Attached to: Bjarne Stroustrup Awarded 2015 Dahl-Nygaard Prize

If you don't check for an error due to sloppy coding, you get a failure sometime later which can be quite hard to debug. If you don't handle an exception, your program exits, and if you can repro the problem under a debugger, any good debugger will break where the exception is thrown - immediately debuggable. Which approach better protects customer data from bugs?

If you check for errors after every call, your program become 80% error checking, 20% business logic. Needless cluster that obfuscates code.

For a large enough C program you re-invent exceptions anyway. The return code from every function becomes the error code. The first thing you do after every function call is check for errors, and either handle the error locally if you can, or return it up the stack if you can't. If you make some handy macros for doing that, you might as well call them "try" and "catch" and "throw", since you're just doing what the compiler does with exceptions, except in a manual, tedious, and eror-prone way.

Really, this was an intelligent argument 20 years ago. The experiment was tried, the data is in, almost everyone moved to languages with exceptions because they make it easier to get it right, not out of some group masochism.

Comment: Re:Poor Alan Kay (Score 2) 192

by lgw (#48896749) Attached to: Bjarne Stroustrup Awarded 2015 Dahl-Nygaard Prize

True, because it is basically terrible for everything, it is terrrible also for using it in the same way as C.

We get it, you don't like C++. I don't like strawberry ice cream.

Yes, RAII is nice. But only *some* memory and resource leaks go away, basically the ones which are trivial, because allocation and deallocation simply follow lexical scope. Ofcourse, this is only trivial in languages which do not have exceptions. Exceptions make this simple thing very complicated, and without RAII it is indeed almost impossible to avoid resource leaks in C++. But without exceptions, it is not so much of a deal. In other words, RAII had to be invented after the fact to make exceptions usable in C++ because - again - some feature were introduced without much thought.

Exceptions are absolutely the right way to do error handling. This was controversial last century, maybe? But it's more than simple RAII - if you have non-trivial destructors, you're likely doing it wrong. Shared_ptr combined with scoped objects fixes the non-trivial ones, and basically everyone uses shared_ptr for everything now. Perhaps over-used, but it gets it right.

This is only a tragedy for people who have to use C++ or think they have to. There is nothing more liberaring than to realize that all this complexity of C++ is completely unnecessary.

I haven't paid much attention to D, but C++ is in a space where none of the othe mainstream languages are. C is quite overused for lack of expertise in C++ - and Java likely is as well.

Comment: Re:Poor Alan Kay (Score 3, Insightful) 192

by lgw (#48896099) Attached to: Bjarne Stroustrup Awarded 2015 Dahl-Nygaard Prize

You can wrote very fast an elegant code in C++ just as easily as in C - it's just a different tool set. C++ is not for writing code using the same approach one uses with C; It's terrible for that. But once you understand scoped objects, all memory and resource leaks go away (well, you can attach something to a global structure and forget about it, but you can mess that up in any language). That alone is a huge win.

C++ has one terrible, fundamental flaw: the learning curve is too high. There's just about nothing where the "right way" is obvious, or even common. And so few people get to real expertise that there's not a common library that collects all those right ways and makes them easy to learn! It's a tragedy, really.

Comment: Re:Interstellar missions... (Score 1) 210

by lgw (#48895995) Attached to: At Oxford, a Battery That's Lasted 175 Years -- So Far

You could set up a mirror array to focus all the light of the Sun into a point. You still couldn't heat up an object there hotter than the surface of the Sun - it would be radiating heat away fast enough to stay at that temperature.

Temperature is a potential: like torque, or voltage difference. It limits what you can do, no matter how much light you focus, just like torque limits the force you can apply no matter how much power you have, or similar with voltage and current. For mechanical and electrical power, getting more potential (with the same total power, less losses) is easy - just add a gear or a transformer.

With light it's also possible, but it's not optics, and it's pretty rare - fluorescent materials which absorb multiple photons of a lower frequency and emit one of a higher actually do exist, and could passively raise the temperature of part of a system, (much to the horror of thermodynamicists). It doesn't violate any conservation rules, any more than a low-temperature heat engine driving a high-temperature electric heater does. But that's not at all what's happening with mirrors and optics, which like are putting your batteries in parallel, not in series.

Comment: Re:Interstellar missions... (Score 1) 210

by lgw (#48895947) Attached to: At Oxford, a Battery That's Lasted 175 Years -- So Far

When light pressure is the dominant force, balancing gravity, and the energy of the system is dominated by the energy of the photons and electrons, conduction isn't playing a big role, percentage wise. The difference between 5/2 power and 4th power means the latter dominates at millions of Kelvin, no?

Comment: Re:Interstellar missions... (Score 1) 210

by lgw (#48891843) Attached to: At Oxford, a Battery That's Lasted 175 Years -- So Far

Photons also have a temperature in the sense that it's the maximum temp you can raise a blackbody to (or maintain it at) no matter how many photons at that frequency you use (the blackbody curve is for an ideal gas, so the idea doesn't extend well to ionizing radiation).

what exactly the physical mechanism is by which kinetic energy causes photons to be emitted

At the level I understand it: knock two molecules together, and sometimes you get a electron elevated to a higher energy state instead of an elastic collision. The difference between that energy state and the ground state is the energy of the photon emitted, and thus it's color.

But that model is really for gasses - get hot enough and the electrons take their time returning to a ground state, or start flying off, and the rules change - the phase transition to plasma - and the kinetic energy of the nuclei starts to fade as the dominant heat energy. Hot enough and you have a sea of free electrons constantly exchanging energy via photons (which don't get very far at the density required for such temperatures). Those conditions are far, far better insulator than empty space, but at the boundary these very high energy photons simply escape: a very different heat-to-light mechanism than in a gas (and simpler than "normal" plasma, which I don't understand at all).

Empty space is transparent, which is another way of saying it provides no insulation at all for radiative heat. At the center of the Sun it's so opaque that no English word can really do it justice, but it takes millions of years for the heat at the center of the Sun to reach a layer where convection is meaningful.

Comment: Re:Bullshit (Score 2) 210

by lgw (#48891779) Attached to: At Oxford, a Battery That's Lasted 175 Years -- So Far

Well, put a AA in a box and come back in 175 years, and try it out. Then we'll see how impressive that is.

Oh-ho, smart guy, see how may of those you'd sell!

It is impressive though. Torpedoes need a high-power battery that can be stored for many years and still be at 100% when needed. They used to cheat, though, and use a wet cell with the chemicals stored separately - mix everything together when it's time to load, and you're ready to go. No leakage unless there's actual leakage. I wonder what they do today - a dry cell with no leakage would be safer and easier.

Comment: Re:I thought they're making money... (Score 1) 199

by lgw (#48889923) Attached to: Verizon About To End Construction of Its Fiber Network

You'd think so, but it's a long, slow buildout to get that return, so growth! would be slow. Companies don't much care about stable profits, since that just means a stock price that stays flat, no it has to be about growth! Without growth! how does a CEO prove he's the guy to make your stock price go up?

It's the most infuriating thing about modern America, really - everyone's chasing capital gains, and dividends are often seen as a bad thing. For a long time there was a good tax reason for that - that's largely fixed now - but the culture is stuck on growth! regardless.

Comment: Re:Good news (Score 1) 420

by lgw (#48888833) Attached to: Disney Turned Down George Lucas's Star Wars Scripts

Titanic and Avatar had better visuals than Serenity, to be sure, and Titanic had some good performances. I thought Avatar was a bucket of problems and flaws with some pretty colors, but really there's few of it's many, mnay flaws that I'm blame on a director. Bad story, bad characters, bad writing is every possible way, sure, but good direction, and the acting wasn't bad relative to the script (there's little an actor, even with great direction, can do to rescue a horribly trite and shallow character, but no one seemed to be phoning it in.)

I wouldn't want Cameron to make a Star Wars movie, because he wouldn't just direct, he'd control other things. I wouldn't want Whedon either - just the wrong tone. Just like Abrams entirely missed the tone of Trek.

It's really obvious from the directors commentary to the Start Trek reboot that most of the flaws in that film come directly from him trying to make a Star Wars film in the wrong franchise! I look forward to his Star Wars movie, lens flares and all, because he'll at least get the tone right.

Comment: Re:Suitable Penalties Need To Be Given (Score 1) 240

by lgw (#48887485) Attached to: Dish Network Violated Do-Not-Call 57 Million Times

Weekly World News had "facts" and photographs too! Some sources are so far from credibility that they actually hurt the credibility of your argument. Zerohedge is one of them.

If it's true, you can find an article about it somewhere credible. If you can't find an article somewhere credible, if it's only on zerohedge, then it's not true.

Comment: Re:Suitable Penalties Need To Be Given (Score 1) 240

by lgw (#48885053) Attached to: Dish Network Violated Do-Not-Call 57 Million Times

You do realize that a zerohedge link is about as credible as a timecube link, and less entertaining, right? The timecube guy likely gives better investment advice, as well.

Again, the usual cases are either there is overlap between large shareholders and company officers (almost always founders), which can get a bit dirty but is mostly just a numbers game, or there's a bidding war for the guy perceived as the best for the job (how much difference in skill there really is between these guys is an unrelated matter).

Comment: Re:Suitable Penalties Need To Be Given (Score 4, Interesting) 240

by lgw (#48882457) Attached to: Dish Network Violated Do-Not-Call 57 Million Times

would take an insanely huge fine to scare away investors

Isn't that what I was suggesting. A fine of say $3 billion structured over 10 years wouldn't put them out of business, but it would be an ongoing 30% hit to earnings. Even if you think they were going to double or triple before, that will significantly hamper growth just coping with the need to come up with the outgoing cashflow. You'd likely see a longterm 20-30% hit to the stock price. Pension and mutual funds don't just shrug that sort of thing off -- their analysts and decision makers have to look smart quarter-by-quarter -- and will do something about gross executive incompetence of that sort.

I've worked at 2 different companies where the CEO was fired, along with most of the top execs. In one case, most of the board was fired too. CEOs live in fear of that sort of thing - they give 0 shits about what you or I think, but they know who their actual bosses are.
 

Comment: Re:Suitable Penalties Need To Be Given (Score 4, Insightful) 240

by lgw (#48882439) Attached to: Dish Network Violated Do-Not-Call 57 Million Times

Just curious, if this is true, why are they paid 100x more than anyone else in the company?

They aren't. There's a normal "power curve" distribution of salaries. You have to understand that CEOs (and to a lesser other extent senior execs of larger companies) are professional entertainers, just like movie actors and professional athletes, and you'll find the same salary distribution in each of the three groups. Sure, they entertain investors and analysts instead of the hoi polloi but even so.

Sometimes the CEO is a founder, of course, and then his real compensation is as a major shareholder, and any salary is just number games, but when it's not there's a bidding war for those seen as the best. If you can make a company of 100,000 people just 1% more productive than the next guy, how much is it worth to the stockholders to get you instead of the next guy? Of course, it's often illusion, but that's just a risk factor in that calculation.

I think there's a world market for about five computers. -- attr. Thomas J. Watson (Chairman of the Board, IBM), 1943

Working...