Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror

Comment: Re:Answer (Score 2) 333

by Jeremi (#49788345) Attached to: How Much C++ Should You Know For an Entry-Level C++ Job?

I have yet to encounter a non-contrived example where multiple interitance is a plausible solution to a problem.

Okay, I'll give it a shot, then... here's where I find multiple inheritance not just plausible, but preferable.

I have a publish/subscribe model including an abstract-base-class/interface (call it IDataSubscriber) that can be subclassed by any object that wishes to be notified about e.g. data updates coming in from the network.

There are a number of common-case standard responses (implemented as concrete IDataSubscriber methods) to those data updates that are useful for many situations, and I don't want to have to have to rewrite them separately for every subclass, so I make a concrete or almost-concrete subclass (e.g. StandardDataSubscriber) that contains this common logic.

Finally, in my client code (based on Qt) I have a number of GUI widgets based on QWidget or QPushButton or whatever. I want these widgets to react to published data in the standard way, so I often end up with this:

class MyButton : public QPushButton, public StandardDataSubscriber {...}

... and it handles my needs nicely. It's also possible to do the same thing with "just" single inheritance and interfaces as well, or with Qt's signals-and-slots, but AFAICT do to it that way you end up having to do lots of manual method-call-forwarding through proxy objects (or, alternatively, lots of manual signal/slot connecting), which is less efficient, harder to read/understand, and more error-prone.

Comment: Re:30 years ago.... (Score 1) 289

by Jeremi (#49778387) Attached to: Amtrak Installing Cameras To Watch Train Engineers

So yeah, it's not as easy as just throwing a GPS on your locomotive and calling it good.

Still, even a partial solution (e.g. one that matches the train's GPS location, if known, against a table of specified maximum-safe-under-any-circumstances speed limits for that location) would prevent a train wreck in certain cases (such as the recent one that prompted this article). I'm all for full PTC, but I don't think the perfect needs to be made the enemy of the good here.

Comment: Re:Time to find better engineers (Score 2) 289

by Jeremi (#49778353) Attached to: Amtrak Installing Cameras To Watch Train Engineers

If the engineers' concentration is so fragile that they are going to be distracted by a camera, they are obviously not the right people to be operating complex machinery.

They suffer from a condition called "being human". It causes occasional failures in an otherwise operational controller-human, some very small percentage of the time. Even the highest-quality controller-humans have a non-zero failure rate.

Maybe we should just replace them with automation and run the trains remotely. They could keep one engineer per train to engage the manual override in the event that someone hacks the control infrastructure and tries to do Bad Things(tm) to the trains.

That is actually a pretty good idea, and it's more or less what PTC is intended to do, at least as far as the "avoid accidents" part of the job is concerned. Automating things further than that is also possible, although probably not really necessary.

Comment: Re:The one question (Score 1) 107

People looking at the car have to be able to tell that that car is an electric vehicle and not an ICE, in order to properly appreciate how the EV owner is saving the planet. By making it ugly, they can also allow the owner to sacrifice further by not driving a good looking car.

That's the cynical answer.

The actual reason that EV cars often look strange is because the designers are trying to make them as aerodynamic as possible in order to extend their range.

As battery power density becomes more adequate, maximizing aerodynamic efficiency will become less of a priority, so in the future you can expect designs that make efficiency tradeoffs in order to get a better look.

Comment: Re:Yeah, good luck with that (Score 1) 333

by Jeremi (#49720443) Attached to: Genetically Engineered Yeast Makes It Possible To Brew Morphine

How would they restrict them to something that someone with enough money couldn't buy their way around?

Now that it's known to be possible, the drug cartels don't even need to buy or steal the recipe. If necessary, they could just hire some genetic engineers to independently re-discover how to do it.

Comment: Re:and dog eats tail (Score 1) 393

by Jeremi (#49718183) Attached to: Feds Order Amtrak To Turn On System That Would've Prevented Crash

And that's a perfectly valid argument. The "We must do something!" crowd won't accept that, but it's valid nonetheless.

It seems like there might be a a way to solve this particular problem more cheaply. How much extra safety could be provided without upgrading any track? If we accept (for the sake of this thread) that this was a case of operator error, it seems like that accidents like this could be avoided by installing onto each train a speed governor linked to a GPS receiver and a known-speed-limits database. While that wouldn't handle all the possible issues that PTC would, I doubt that would cost anywhere near as much as upgrading thousands of miles of track. That might be a reasonable safeguard to install in the short term while waiting for a more comprehensive solution to be funded and installed.

Once it hits the fan, the only rational choice is to sweep it up, package it, and sell it as fertilizer.

Working...