Goodbye, shitty "Car extends Vehicle" object-orientation tutorial - <AUTHOR> http://lists.canonical.org/pipermail/kragen-tol/2011-August/000937.html <comment><USER2> Heh, I agree somewhat that the Duck>Animal is a bit annoying.. but this:

      Here's an example that I think would be better to use instead: the
      `Visible` hierarchy in [Pygmusic][], which is a kind of software drum
      machine.  A `Timer` is a horizontal strip on the screen with a stripe
      racing across it. A `NumericHalo` is a spreading ripple on the screen
      that fades. A `Sound` is a thing on the screen that makes a sound when
      a `Timer`'s stripe hits it. A `Trash` is a thing that deletes `Sound`s
      when you drop them on it. They all inherit from `Visible`, which
      represents things that can be drawn on the screen and perhaps respond
      to mouse clicks or drop events, but they do different things in those
      three cases. In addition, the `Trash` and `Sound`s are subclasses of
      `ImageDisplay`, because the way they handle being drawn is simply to
      display a static image, so that code is factored into a superclass.

Is by far worst.. The goal of the Person or Duck is to pick a _trivial_ example to explain some concept. Of course you're not building Sim city and that it will be totally different in real apps.

Also, it's true that inheritance is often the wrong solution and could arguably be said that it create more problems than it solves. However, before understanding all the pitfalls and the why/why not of inheritance, you first need to _understand_ what inheritance is!

So, instead of _shooting_ someone who give an example with a Duck to explain OO, let just say that this tutor should say beforehand "Let's take a trivial example to understand the concepts of OO. Later on, we'll see why this is not always the preferred solution."

<comment><USER3> Probably if you have a trivial piece of code, you don't need inheritance to help you structure it. But you're right that we need a smaller example than the entire class hierarchy of Pygmusic. What do you think would be the smallest sensible example?

If your objective is only to explain _what_ inheritance is rather than _why_ someone would use it, you could probably write two classes and three methods:

        class A:
            def z(self):
                print "z " + self.y()
            def y(self):
                return "Ay"

        class B(A):
            def y(self):
                return "By"

        A().x()
        B().x()

But I really think that most people will find a program easier to understand if it's not completely abstract like that — if it reflects some kind of intentional process where a programmer was trying to achieve something. But in order to explain inheritance in such a context, you need a program where inheritance makes things better instead of worse. What do you think is the simplest possible piece of code that would do that? I am thinking of a very- much-cut-down version of Pygmusic with only two drawable objects.

<comment><USER4> Device drivers. You have a base class, device, which supports at the minimum, read() and write(). Then you subclass to block and character devices, and so from there. It's a real world example (Unix does it, although in C) and it's simple enough to explain the concepts.

<comment><USER5> But delegation is a better solution than inheritance for this, i.e. the printer driver class takes a character device instance _as a parameter_. Delegate the character device's read and write methods to the printer driver's class, make the printer driver do the same interfaces, and done. Now you have something that composes better than inheritance and substitutes anywhere you needed a character device.

</comment></comment></comment></comment><comment><USER6> > You can't add code to ducks.

You do if you are creating a piece of software to track ducks.

I don't get the impression that the person who wrote this ever had to seriously teach software development to software developers. Simplistic metaphors are used so frequently for this kind of thing because it prevents the learner from having to ascend more than one conceptual hurdle at a time. The alternative that he's proposing (learning inheritance in terms of some obscure drum machine software) would imply that the learner spend half their time digesting how this drum machine works, then the rest of their time (assuming they're still awake) figuring out how that relates to inheritance. It isn't helpful.

<comment><USER7> You can explain is-a using examples that actually make sense to model using inheritance, like a set of game objects that have an interface like:

        class GameObject {
         public:
          // Called every frame to update the object's logical state.
          void Update(GameState* state);

          // Called to draw the object.
          Draw(GraphicsContext* context);
        }

        class EnemySpaceship : public GameObject { /* ... */ };
        class SpaceDebris : public GameObject { /* ... */ };

The point is to move the discussion into the practical reasons for introducing inheritance, rather than to make it a pointless ontological exercise of whether a Square is-a Rectangle or vice-versa.

<comment><USER8> Most of the benefits of OO programming come from abstracting the machine / concerns (eg. MVC) rather than modeling the domain. (eg. Cars / Ducks / etc).

I know it's just an example but it raises several important questions:

Why does the GameObject need to know how to render itself?

Why does the GameObject update the GameState which the GameObject is ostensibly also a part of?

Does updating the GameState directly affect the ability to separate concerns as to whether the GameState being modified is local vs. remote?

When you start modeling domains it leads very easily to situations where you have hardcoded permissions for the Manager class instead of bothering to implement a permissions system. Or you have a CEO class that's a singleton. (Hopefully, your code doesn't have to work at RIM)

The code savings from

      class DeathStar2 : DeathStar {
        public override FatalFlaw(){}
      }

is going to pale in comparison to

      class DeathStar2 : Object {
        acts_as_travelling_salesman
        has_many :laser_turrets, :max => 1024
        has_many :tie_fighters, :max => 2048
      }

when applied over many many systems and objects. Modeling domains is to modeling concerns as algebra is to calculus. Most things in life despite their appearances are not hierarchical and thus do not fit well when modelled explicitly using a class hierarchy. Showing people how to model a domain is easy but virtually useless, showing people how to model concerns is hard but is where the big payoffs are.

<comment><USER6> Code savings isn't a reasonable goal of OOP. Information-hiding (in which you take an arbitrarily-complicated method and abstract it behind a class) is.

<comment><USER8> When you give people inheritance all they see is hierarchies and when you give them information hiding systems all they see is access control.

One should not be able to find trade secrets by grepping for "private", nor reproduce a companies org chart by a class inheritance graph.

</comment></comment></comment></comment></comment><comment><USER9> I disagree with the arguments in general and find that modeling real world, common items is much more illuminating from a teaching/learning point of view. It would be an ridiculously long post to explain why, but here is an example picking one of the author's bullet points: "Penguins don't implement the fly method that can be found in birds."

Should bird even have a fly method? Only if all birds fly. And the application will have penguins, so the answer is "no". This doesn't make the Duck extends Bird example a bad thing though. It points out that if you do shallow domain analysis, you will end up with a poor OO design where you shoehorn things like "fly" into penguins for example.

If some birds fly and some don't, some swim and some don't, some burrow and some don't, etc. you might implement this with "mix in" interfaces like "Flyer", "Swimmer", "Burrower", etc. This is a good lesson in how one can distribute different behaviors across a class hierarchy without polluting the common base interface of the hierarchy (i.e. without forcing all birds to fly). However, this burns the behavior into the concrete classes, prevents things like modeling the fact that baby (or dead) birds cannot fly/swim/burrow, and does not allow for sharing different fly/swim/burrow implementations across bird implementations (in languages like Java anyway). In other words, it shows why inheritance can be a good choice, and also a bad choice.

A common solution to this would be to use two hierarchies - one is the bird hierarchy that all birds implement (with behaviors like "preen feathers"). The other is the behavior hierarchy that all behaviors implement. Birds "contain" a list of behaviors. Code that operates on birds knows the bird interface has methods that make sense for all birds. Code that operates on behaviors like fly/swim/burrow would have behaviors passed in, or perhaps ask the animal in question "do you know how to fly?" and if yes, ask for its fly behavior. There are many variations on this, but the point is that there is a separation of concerns: bird concerns and behavior concerns. This helps teach the trade-off between inheritance and containment (e.g. behaviors not burned in through inheritance can be added/removed over time, for example, when a baby bird learns to fly).

The point though is that this kind of example (Duck extends Bird) helps one understand how to model real world items so they match the domain, to learn about separation of concerns, learn the pros/cons of inheritance/containment, design patterns, and perhaps most importantly, do so using concepts most people will more readily understand (cars or birds or people).

<comment><USER10> Indeed.

The example with Birds, Ducks, and Penguins is much more colorful and fun then example with GUI widgets. It sticks. Students will remember ducks & penguins, but fall asleep before you even finish describing that boring GUI system.

Plus, nothing prevents you from using the same fun example to illustrate the second point. E.g. you can show that while penguin _is a_ bird in real world, in your application Penguin might actually inherit from Pinniped, because it _behaves like_ one (and it's "behaves-like", not "is-a" that we care about).

<comment><USER11> If a CS student falls asleep when you talk about GUI systems, they're not in the right class.

I didn't need fluffy birds and colorful metaphors to get into this passion of mine.

The audience doesn't deserve to be patronized like that.

</comment></comment></comment><comment><USER12> Way back when I was first learning OOP, the typical "car extends vehicle" examples caused me not to see the practical point of OOP for a long time. I _still_ resist using object-oriented approaches except in cases where the code demands it. (A feature, not a bug?) And, these days, if I do use OOP in places in the code, it's for encapsulation -- which is only a _style_ consideration -- so the "car extends vehicle" example still doesn't apply.

I think a simple example from GUI programming would do much better. How about window classes? I did something like this recently:

        class Window {
            public method show()
            public method title(newTitle)
            public method close()
        }

Easy enough. What if I want a modal window though? Almost everything in it would be the same as a regular window, except I might need to do some things slightly different for show()ing and close()ing the window. Aha! A perfect example of an appropriate time to create a subclass:

        public class ModalWindow extends Window {
            public method show()
            public method close()
        }

Programming tends to attract practical individuals. I think teaching "car extends vehicle" then is usually going to cause one of two results: either a student that then uses that approach all the time, even in cases where it's not warranted, because they don't understand when it's appropriate and when it's not; or a pragmatic student that resists using it because the given examples don't apply to anything that they're actually going to have any chance of working on.

<comment><USER13> I don't think so. In a windowing library you would do better to have the IWindow interface and have both Window and ModalWindow implement IWindow. Decorator then is appropriate so that ModalWindow can wrap Window and add the desired functionality. I would not subclass Window in this case. This leaves Window and ModalWindow totally substitutable and totally decoupled. If you extend you couple Window and ModalWindow. Less coupling will likely serve you better.

I eschew inheritance except for when two objects or libraries are very much the same thing but the implementations are different. Just an example, where I might want to have the opportunity to use two different PDF libraries.

Further, there's a case where a number of objects share some common methods and you may decide to implement an AbstractWindow where those methods can live. But, you may find that Aspect programming works better in that case.

Generally, and perhaps surprisingly you shouldn't use inheritance in most cases. But inheritance is nonetheless a very important part of OOP.

<comment><USER14> Why would you want inheritance for different PDF libraries? This seems like interface to me - the DOM interfaces are an appropriate analogy.

<comment><USER13> Quite right. I didn't express that very well. An interface is appropriate with implementations for each separate library.

</comment></comment></comment></comment><comment><USER15> The only situation where I could see not wanting to hear the car extends vehicle example of inheritance is in an interview where you want the candidate to give a practical example of inheritance. I see nothing wrong with using an example even a child could understand as a first stab at explaining inheritance.

Fairly annoying how quickly a mostly useless rant such as this has jumped to the top of HN.

</comment><comment><USER16> He asks for a simpler example. How about a collections api? Start with array, then linked lists, then functioms like contains and filter and which need an iterable interface, then different types of linked list, then add hashmap where you iterate keys, then different types of map e.g. linked map. This is all data structures 101 material anyway! After this primer, a simple GUI toolkit isn't as far out of reach.

</comment><comment><USER17> I think the best introduction to object oriented design is shown in the first chapter of Martin Fowler's book "Refactoring" _. He gives the example of a DVD rental shop that has to calculate the rental fee based on the type of DVD: \- A New Release is $3 per day \- A Children's DVD is $1.50 for three days, then $1.50 per day after that \- A Standard DVD is $2 for two days, then $1.50 per day after that

_ [http://www.amazon.com/Refactoring-Improving-Design- Existing-...](http://www.amazon.com/Refactoring-Improving-Design-Existing- Code/dp/0201485672)

<comment><USER5> The rest of that book, unfortunately, is stuff like: "To move code from one file to another, follow these simple steps. Step 1: Delete the code from the source file. Step 2: Add that code to the destination file. Step 3: Update references to the code in (1) to point to (2). Step 4: Recompile your project and fix the parts that don't compile."

What insight!

</comment></comment><comment><USER18> I've been working on writing a programming book for quite some time now, and I can tell you that coming up with good examples is really hard.

For me, a good example meets as many as possible of the following demands (in no particular order).

An example should

* demonstrate the feature or concept under discussion

* be short - shouldn't be more than half a page to a page

* solve a problem that the reader can easily understand

* solve an interesting problem

* not use unrelated features of the language or library that haven't been introduced yet

* should avoid complexity unrelated to the feature or concept under discussion

* should be as close as possible to what one would use in "serious" (ie non-teaching) programming

I found that i spent about as much time searching for good examples as actually writing text or code for the book. I'm pretty happy with some of the examples (for example the chapter on grammars parses JSON, which is rather real-world, but not too complicated), some of them still fail most of the demands given above.

(If you're curious, grab the latest PDF from <https://github.com/perl6/book/downloads> \-- it's still very much a work in progress).

</comment><comment><USER19> One of the first examples of OOP I encountered was the old 'shape' hierarchy demonstration: 'shape' is a base class. 'rectangle' is a new class that inherits from shape. 'square' inherits from 'rectangle', etc.

It demonstrates the ".. is a .." relationship that inheritance describes perfectly.

This is a pretty common way to introduce OOP as it draws on stuff we all know intuitively. The example proposed with a bunch of drum machines concepts, trash, timers & stripes or whatever is so mind bogglingly obscure for most people that I'm sure they would have checked out long before the actual OOP lesson begins.

Not sure what the point is.

Oh, and btw, just because you might not ever need to represent a 'duck' object, doesn't mean that it is a stupid example. Say I write a game with a bunch of actors, I might have a base actor class, a bird class that extends that, and a duck class that extends that. Bam, legitimate use for a 'duck' object. There's probably a lot more people wanting to write "a clone of the sims" than "an intractably obscure drum-machine".

<comment><USER3> > 'square' inherits from 'rectangle', etc. ... It demonstrates the ".. is a > .." relationship that inheritance describes perfectly.

Your comment is a perfect example of why this is a terrible way to teach object-oriented design: if your squares and rectangles are _mutable_ , as they usually are in the old shape-hierarchy demonstration, you've just violated the LSP and introduced a subtle bug into your program, _in the very first line of your comment_. If you understood object-oriented design, you wouldn't do that. You've been tricked into thinking you know how to do object-oriented design, but your sense of competence is an illusion.

For what it's worth, although I don't have any real experience teaching other people to program, I've found that animated graphics that make sounds hold the attention of nontechnical people a lot better than abstract hierarchies of Platonic geometric shapes. I haven't compared them with bird-flocking simulations.

</comment></comment><comment><USER20> Depends on the audience. If you're using the "Car : Vehicle" example, you're probably explaining the basics of OO to a newbie. I think that's a fine example. If you're talking about more advanced topics, then you can use a more advanced example. In fact, you can use different examples suited to different topics! Relax, there's no need to be a pedant.

<comment><USER21> Honestly, when I was a newbie, the simplistic examples drove me crazy because I didn't get the point. I can solve the toy problem effectively with concepts already introduced (functions) why am I burdening my code and my brain with all this new overhead?

The OP's suggestion to use a GUI interface is much better. GUI objects like windows are a common and interesting subject. Ironically, Object Oriented features in languages like Java and C# made a lot more sense to me after writing a Win32 gui app in straight C.

</comment></comment><comment><USER22> The problem people have with "Car extends Vehicle" is that they expect magic. It's the same impatience we sometimes feel with little kids because they're not grasping something we've been taking for granted for decades. If you're trying to teach someone _new_ to OOP, there is _no_ example that will take them from their current level of knowledge to yours, in one fell swoop. You can't expect them to grapple with decisions such as "inheritance vs. delegation" when they're only now learning what inheritance is all about.

So yeah, "Car extends Vehicle" and "Duck extends Bird" works pretty well at that point. You can try to cram "Penguin" and "Helicopter" and "Flyer" and "Vehicle" down your students' throats in the same lesson, but I doubt that will magically make them digest it properly. And if you can't do that with easy stuff like "Duck" and "Bird", how do you expect them to swallow "NumericHalo" and "ImageDisplay"?

</comment><comment><USER23> This is ridiculous. I'm teaching part of a course called "programming for biologists" this fall including the part about object oriented programming. Most of my students are ecology grad students. You're telling me I shouldn't use simple animal examples, when these are exactly the types of things my students are going to be modeling?

</comment><comment><USER24> 1\. I absolutely agree with the linked article. My perspective is somewhat different, however. I submit that OO hierarchy should not mimic whatever properties whatever _real-world objects_ may happen to possess. Instead, when we solve a problem and have come up with a solution, the OO hierarchy should describe the solution. A different solution, or a different problem, may easily lead to a different hierarchy of (perhaps different) objects. And these would be _software objects_.

2\. Therefore, I suggest that a "simple" example would come from a well-known software system. Such as a window system (rectangle, button, icon, window, etc) which, either as a concrete example or an abstraction, should be easily understood by anyone with a minimal (desktop) computer experience and no programming experience.

</comment><comment><USER25> I completely agree with this. Duck-laden object oriented programming tutorials made no sense as I tried to transition from C to Objective-C.

The best explanation I found was Chapter 2 of Apple's "Object-Oriented Programming with Objective-C":

 _Every object has both state (data) and behavior (operations on data). In that, they're not much different from ordinary physical objects. It's easy to see how a mechanical device, such as a pocket watch or a piano, embodies both state and behavior._

[http://developer.apple.com/library/mac/documentation/cocoa/c...](http://developer.apple.com/library/mac/documentation/cocoa/conceptual/OOP_ObjC/OOP_ObjC.pdf)

</comment><comment><USER26> I actually think these are really good examples. I especially like the shape example, because you quickly run into problems where you can talk about the difference between modeling for a solution and representing an abstraction.

</comment><comment><USER27> I fail to see the problem. I would bet that there are tons of real games that actually have a Car class that extends Vehicle.

</comment><comment><USER28> The thing is that there ought to be no trivial examples of object oriented paradigms because they are never trivial.

If you're good you can create object oriented interrelations that work but end up having object charts which have that plastic, phoney kind of artificiality that makes little natural sense. If you're a god-like programmer you can come up with interrelations of code and data that make perfect sense but they're quite not always object oriented.

As for OO, the best thing I've settled with is this:

\- Scoop up all your programming experience and first think how do you want to reuse some code or some data structures

\- Then you go and look up appropriate paradigms and language features that _could_ support your case of reuse

\- And finally you go figure out how to best do it in a natural way in your programming language.

However, I often start with basic lists and dicts and only after something becomes truly obvious and a near-universal trait, I might make a class out of it if I can better reuse code that way. An archetypical example would be something like a BaseObject that supports some protocol for init, deinit, and refcounting, for example. Everything else can adhere to that protocol. Better yet, I'll make it an interface so I can decouple the implementation of the protocol from the definition of the protocol.

</comment><comment><USER29> Yes, a thousand times yes. I have never understood why dependency injection is not taught in OOP courses -- as described in the article, DI truly shows why OOP design is useful. Conversely, the "domain model"-approach commonly used probably gains some of its attraction due to the similarities to E/R database diagrams, but far from always lead to designs which are actually useful in practice.

</comment><comment><USER30> Is Kragen making an elaborate joke about duck typing here?

Penguins don't implement the "fly" method that can be found in birds. And you don't go around causing things to fly without knowing what kind of bird they are. (Ducks themselves decide when they want to fly, and they certainly seem to know they're ducks and not vultures.)

<comment><USER3> > Is Kragen making an elaborate joke about duck typing here?

Not really, no. I was just saying that "fly" methods on hypothetical bird classes fail to motivate OO.

</comment></comment><comment><USER31> Just one piece in the whole _object orientation blows but still is the best thing we have to make complex systems understandable to simple people_ quandary.

It is true that the real world object examples confuse everything that OO is really used for. It is also true that we need them to make OO approachable at all.

OO is essentially an ontological cluster-f _ck where multitudes of logical and representational levels are trampled on. The thing is, OO_ uses* the adhoc mixture of logical confusions that is most people's description of their world. Somehow people's amazing brains muddle through speaking natural language despite it's terrible muddling of everything. Thus we can stand the confusion of not really knowing whether "class window" is a glowy thing on the screen, a location in memory or an abstract datatype.

</comment><comment><USER32> I would also add. Don't introduce a language by showing how to compute the Fibonacci sequence.

I never have and never will need to compute the Fibonacci sequence. Recursion is such an infrequent part of everyday programming that it doesn't really matter if a language makes it easier.

<comment><USER33> It is frequent in some applications, and when programming in languages that encourage you to recur instead of looping (see: functional proramming). Also, recursion is one of the most important concepts of computer science.

I didn't really use recursion in my programming until I switched from C++ to Common Lisp.

</comment></comment><comment><USER34> >One disadvantage is that it has to deal with a fair amount of arithmetic; there's lots of `/ float(n)` and `* self.rect.w + 0.5` and `self.size __2/2 * (1 - (1 - age _2)_ *2)` and the like, which I think reinforce a common misconception about computer programming: that you need to learn algebra and arithmetic in order to write programs, and that programs mostly deal with numbers.

Is this really such a disadvantage? Algebra and arithmetic are hardly advanced subjects. Isn't it fair to insist that programmers know at least middle school math before they program?

<comment><USER3> > Isn't it fair to insist that programmers know at least middle school math > before they program?

Certainly not! I started programming when I was 4, many years before I got to middle-school math. And there's a great deal of software in the world that has very little to do with algebra or arithmetic. It's easy to open up [http://www.canonical.org/~kragen/sw/urscheme/compiler.scm.ht...](http://www.canonical.org/~kragen/sw/urscheme/compiler.scm.html), for example, to a random page and see no arithmetic at all. The same would be true of [https://github.com/evilstreak/markdown- js/blob/master/lib/ma...](https://github.com/evilstreak/markdown- js/blob/master/lib/markdown.js) if JS didn't require you to use arithmetic to iterate over arrays.

</comment></comment><comment><USER35> I don't get what is soo wrong about the car example, because of it i grasped the object orientation style instantly. What's easier to undderstand than this!?

</comment><comment><USER36> Inheritance. Gah, why won't this bad idea die!

Shared calling protocol, shared data sub-structures, fixed compile-time equivalence hierarchy, all clumped together.

Go gets it right. Cut the linkage between composition and equivalence. Composition handles inclusion/merging of existing objects. Interfaces handle equivalence of objects. Interfaces can have hierarchies, but there's no one true hierarchy baked into the objects they describe.

</comment><comment><USER37> The example for inheritence I liked best was something like this:

Number (implementing trivial exponentiation through multiplication)

RealNumber & ComplexNumber implementing their specific kind of multiplication.

Later on replace the exponentiation by fast exponentiation. This directly demonstrates the benefits of avoiding code duplication.The change only has to be made in one place.

</comment><comment><USER38> The real truth being that not even one thinks the same way. Some people learn better with visuals versus some who prefer text.

Some people see no problem with Vehicle->Car or Animal->Duck or whatever other ultra basic OO example.

In the end what's best is whatever can make someone understand the concept.

</comment><comment><USER11> In my experience, there's a process where adding accuracy (and thus usually complexity) to a domain model, implies removing existing inheritance assumptions.

For instance, in the trivial case an Employee is a Person, but when you go further you discover that there are all sorts of relations that need more detailed fleshing out. Is changing jobs just a call to Employee.setEmployer? That certainly feels akward. And as that process continues, you get a more complex domain model with comparatively less fixed inheritance relations.

The extends keyword sortof becomes an extend object, first-class among your domain and susceptible to dynamic behaviour.

But can you teach kids that in a first OO class?

EDIT: care to explain the downvote? I'm quite passionate about this subject so would love to debate it.

</comment><comment><USER39> Good to remember Alan Kay's guideline here - "OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late- binding of all things."

</comment><comment><USER40> THAT'S WHY ITS A BEGINNER TUTORIAL. Get off your high horse.

<comment><USER41> The criticism being put forward isn't at all arrogant. A tutorial for beginners that teaches you the wrong thing is incredibly detrimental. It's good to point that out and fix it.

<comment><USER40> "Duck extends Bird" is not the wrong thing at all. As other comments have pointed out, the justifications in the article don't apply to someone who is just starting out learning the basics of OO.

</comment></comment></comment><comment><USER42> "Car extends Vehicle" is a perfectly fine example to introduce someone to OO programming. That's all.

</comment><comment><USER43> If I understand correctly, this rant is about the use of simplistic examples in teaching OOP, correct? i.e. it's not just about using such examples when debating language features.

If so, then I very strongly disagree with this guy. I have painful memories of trying to come to grip with OO in high school in the early 90's. Sure, those zoological and automotive examples are almost insultingly trivial, but that's because you don't need real-world engineering complexity interfering when you're just trying to wrap your head around inheritance and extension!

Bird ==> Duck makes sense because they're classes. As in, those are classes of animals in the real world, and there is a relationship among them. Expressing that relationship in code doesn't mean you're coding animals, it means you're modeling a real-world class hierarchy with your data definition.

I think that people are forgetting that OOP is actually _hard_. If you don't already have a very strong grasp on the underlying mechanics of a language (e.g. function pointers and vtables in C++), then it's going to always seem like magic.

<comment><USER3> I appreciate your disagreement, and I might be wrong. My concern with those examples is not that they're _trivial_ but that they're _misleading_.

</comment></comment><comment><USER44> Nothing annoys me more than this kind of analogy. People who are trying to understand it can't figure out what a Duck really is in this scenario, and what it means that it's a subclass of Bird.

Use simple but realistic classes as examples.</comment>


Show HN: Effort to clone unmaintained SourceForge projects to GitHub - <AUTHOR> https://a-sf-mirror.github.io/ <comment><USER2> Why Github? Copying from one commercial provider to another doesn't solve the fundamental problem. Using git helps, but most of those old repos will never get cloned.

In 10 years time, Github may be the tired old service that gets acquired by a hedge fund that decides to monetize their repos. Such things are part of the corporate lifecycle.

<comment><USER3> Do you have any other suggestions? Hosting these repos on donated/personal machines is (IMO) significantly less likely to stand the test of time.

At least with a commercial entity there is a bit more "trust" involved that they won't disappear out of the blue one day. And if the time comes that Github starts to collapse, the process can be repeated.

Just because something isn't permanent doesn't mean it's pointless.

<comment><USER4> > Do you have any other suggestions?

Archive.org ?

And weird that nobody suggested the Bitcoin block chain. I don't think binaries are a good fit but source code doesn't require a lot of space. With the current and future block size it will take sometime to make it happen.

<comment><USER5> Archive.org (while an amazing resource created lovingly by amaing people) is not a great front-end for stuff like this. Github is very easy to get started with and excels at code hosting. As for the blockchain that's a terrible idea, there are so many things wrong with it including the cost to push all of that data into the blockchain and the fact that while source code can be small it isn't always and it's magnitudes of times larger. Right now each block is 1MB and blocks take some 10 minutes for just 1 confirmation so you are looking at < 1.7KBpss (13.6Kbps) "upload" speeds. IF you actually attempted this you would have to have some sort of header on each transaction to tie it all together which lowers the speed even further. I'd bet money that if you started uploading nodes would either ban you or the core devs would do something to stop the chain from being filled with shit that now has to get replicated to 10's of thousands of machines across the globe.

<comment><USER4> I received a lot of downvotes but my comment was a bit ironical since in many forums (even in HN in the past) when someone talked about backups many people suggest the block chain.

I said: _With the current and future block size it will take sometime to make it happen_.

<comment><USER6> The absurdity of that suggestion it not absolved by the fact that someone else has said it before, or by the fact that you said it will take 'some time for it to happen'. It's completely not an option for the migration we're discussing.

<comment><USER4> It is not absurdity if it is irony and I clearly said that it can't be done now but may be in the future. I can't see the future, do you?

<comment><USER7> It's not practical, but it's a worthy goal for blockchain computing, or some descendant of it. So I am glad you brought it up.

</comment></comment></comment></comment></comment></comment></comment></comment><comment><USER8> Why aren't you mirroring the binaries? These are vital for people in the future who do not have the time to set up a build environment for software from a decade ago.

I'd also echo the concerns of others about GitHub.

Proper archivists should do for SourceForge what they did for other projects. Archive Team, maybe? Looks like they have a wiki page: [http://www.archiveteam.org/index.php?title=SourceForge](http://www.archiveteam.org/index.php?title=SourceForge)

<comment><USER9> This was in progress, 830GB was downloaded before a Sourceforge guy popped onto the IRC and said he's ok with the archiving, but that the robots.txt should be respected. This would put things at a practical standstill. So the downloading was paused, I'm not really sure what's happened in the week since.

Right now Xfire's videos, several URL shortners' links, and Toshiba Support material are being archived. If you have spare cycles and bandwidth, and want to contribute, running an instance of the "ArchiveTeam Warrior" is pretty easy through docker or a VM. [http://archiveteam.org/index.php?title=Warrior](http://archiveteam.org/index.php?title=Warrior)

<comment><USER10> Honestly I think ignoring robots.txt in this case is acceptable. Even if he programs in code to respect robots.txt - once the management at sourceforge get wind of what he is doing - what is stopping sourceforge from putting up robots.txt everywhere blocking him?

<comment><USER11> Look at their current robots.txt; they're already prohibiting robots to crawl the actual source code: [http://sourceforge.net/robots.txt](http://sourceforge.net/robots.txt)

</comment></comment></comment></comment><comment><USER12> Honestly, this is a serious issue for my field. There are so many obscure academic binaries hosted on SF... I hope someone manages to mirror them. [The fact that a lot of the scientific community is so backwards in adopting modern coding standards is another conversation for another day.]

</comment><comment><USER13> Sourceforge is on the radar here, but maybe it's time to step it up.

[http://www.archiveteam.org/index.php?title=Fire_Drill](http://www.archiveteam.org/index.php?title=Fire_Drill)

Update: seems others have linked to archiveteam.org, so maybe that's the best route. Is the OP part of the AT effort or do they know about each other? Maybe they should.

</comment><comment><USER14> Nice! But in my opinion better help archiveteam with their efforts!

<comment><AUTHOR> I confess my ignorance regarding archive.org's various collections. There seem to be a lot of them, which one are you referring to?

<comment><USER15> They're not a part of archive.org (just a totally separate group with similar interests, lead by Jason Scott). The specific project page is here: [http://archiveteam.org/index.php?title=SourceForge](http://archiveteam.org/index.php?title=SourceForge)

The best place to pop in is probably on IRC. For the Sourceforge project it's #coldstorage on EFnet, [http://chat.efnet.org:9090/?nick=&channels=%23coldstorage&Lo...](http://chat.efnet.org:9090/?nick=&channels=%23coldstorage&Login=Login) for the web client. Though note, the ArchiveTeam project seems to be paused right now.

<comment><USER9> To add to this - ArchiveTeam often works with archive.org who have arranged long term storage for a lot of retrieved content.

</comment></comment></comment></comment><comment><USER16> Nice.

I agree with what the others are saying, there's a lot of source code for solving obscure programs that is only on Sourceforge.

One example I found recently is a program called QLumEdit. I recently had to figure out how to work with EuLumdat files, and if it wasn't for the source code for this program on Sourceforge I would have been completely stumped (well not quite, but it would have taken me ages).

If SF goes down the toilet, a lot of knowledge goes with it so this is awesome to see!

If anybody is interested, I was converting this code from C++ to .net, my horrible hacky unrefactored effort is here - [https://github.com/bumblebeeman/eulum.net](https://github.com/bumblebeeman/eulum.net)

I am planning to make this code nicer, and develop it into a WPF app when I have time!

I am getting pretty close too, here is my .net generated version of the images this program produces: [http://imgur.com/PCmpnJ2](http://imgur.com/PCmpnJ2)

</comment><comment><USER17> That's great. I started doing that myself (my own git server, not github) for some projects I care about. This effort seems include a very narrow list, though.

For CVS, though, I suspect cvs-fast-export [1] will do a better job than git- cvsimport.

1 [http://www.catb.org/esr/cvs-fast-export/](http://www.catb.org/esr/cvs-fast- export/)

<comment><AUTHOR> Thanks, I'll have a look

</comment></comment><comment><USER18> What about creating a torrent containing all these unmaintained SF projects (with binary downloads included)?

This would dramatically increase the odds that the content is never lost.

<comment><USER19> The problem with torrents is the lack of incremental update support. If the base torrent gets updated it gets a new hash identifier. How do you know its been changed to ensure you get the latest version. When you do the swarm effectively gets diluted because some are on the new architecture and some are on older versions.

<comment><USER18> If the SF projects aren't being updated, then what's the issue? The information is, by definition, static.

</comment></comment></comment><comment><USER20> > Currently, for each cloned project, we mirror its CVS repository and its > website.

Please add "SVN" (Subversion)

</comment><comment><USER21> This seems much more like a temporary fix, not really a solution. A few years from now GitHub can do the same thing that sf did. This after all seems to be the fate of commercial companies that explore open source, once they start to lose users to new competitors.

</comment><comment><USER22> Note 1: Moving things to GitHub or elsewhere does not remove them from SourceForge. So SF can continue to host and enjoy links on unmaintained websites, search engines etc.

Note 2: If their business model is offering popular binaries and source, they can just copy these from other sites and repackage them. Open source software allows you to do this. If no one else is interesting in bundling and monetizing, then they can buy traffic and still succeed.

Note 3: Remember that academy award winning movie from 1943? Not so great it today's light. While perhaps one of the goals of the Internet and cheap storage is to keep a copy of everything, and its often better to _not_ re- invent the wheel, if something fall by the wayside, and its needed, it will be created.

Note 4: There are plenty of websites which catalog useful abandonware, that someone had to find a physical disk drive from. If the software has value, chances are someone will eventually repost it somewhere without a massive organized effort.

\----

There is clearly value in moving over some project to GitHub or elsewhere, but if some things are not migrated or moved life will go on.

<comment><USER23> Per the historical record, that "academy award winning movie from 1943" was 'Casablanca'.</comment></comment>


Twitter Suspended Sdkman.io Account - <AUTHOR> https://twitter.com/marc0der/status/1263008011112656897 <comment><USER2> The twitter account got suspended when the date of birth of said account was updated to the day of the first commit in Github for this project.

A case was opened on Sunday 16 May 2020, but Twitter Support have been completely unresponsive up to now, 21 May 2020.</comment>


Technical Analysis Library - <AUTHOR> http://ta-lib.org/

<comment><USER2> Anyone here ever used this lib for any side project?</comment>


The Rocket Man Who Wants To Beat the Billionaires - <AUTHOR> http://www.popularmechanics.com/space/rockets/a17574/masten-space-systems/ <comment><USER2> Love this, very inspirational and pragmatic. I like how down to Earth Masten comes across in the article (pun intended). Reminds me of the lesson learned in the restaurant business - over-estimate the wait time, deliver early, and let people enjoy!

I think it's something about the inherent risks and rewards of flight that are a great challenge and temptation for advancement - space being a dream for so many from childhood. Maybe it makes us feel a little more important in such a grand universe.

The Wright Brothers were bicycle mechanics. They beat out the entire world into manned, powered flight. Creativity, some resources, and tenacity can do wonderful things.

<comment><USER3> There's an important insight in there that I think a lot of people miss. It reminds me of the old, probably apocryphal, story about the maintenance guy who comes out to visit some machine that's malfunctioning, hears about what's wrong, then goes and hits it with a hammer, causing it to start working again. The business owner complains about the bill, since anyone can hit something with a hammer, so the technician creates an itemized receipt, wherein "knowing the right spot to hit" is the majority of the cost.

So much of anything is knowing the right thing to build and the right way to build it. Everything else tends to be much easier problems to solve. The same thing is true in rocketry. And that's what's so exciting about these startups, they're not just trying to fill the shoes of past generations, they're innovating, they're doing research. They're developing the knowledge base and experience base that will serve as the foundation of a tremendous amount of future work. Once you've developed the fundamental technology components and figured out an optimum vehicle design then you just have scaling up and iterating (as SpaceX has done, for example), which is a lot more straightforward.

<comment><USER4> The crafty engineer was Charles Steinmetz, and the business owner balking at the invoice was Henry Ford [1]. EDIT: Maybe not so true after all [2].

I had never heard of Maston Space Systems. It's amazing they were able to compete with such massive names in Boeing, and Lockheed.

[1] [http://www.smithsonianmag.com/history/charles-proteus- steinm...](http://www.smithsonianmag.com/history/charles-proteus-steinmetz- the-wizard-of-schenectady-51912022/?no-ist)

[2] [https://news.ycombinator.com/item?id=10389203](https://news.ycombinator.com/item?id=10389203)

<comment><USER5> There are real life examples though, my father being one. On one job he did, he flew from Australia to Malaysia, walked into the factory, turned a single valve on to get a major machine working, then walked out job done.

</comment></comment></comment></comment><comment><USER6> Great. First Musk, now Masten. I'm incredibly hopeful that entrepreneurs will keep challenging the massive, monolithic companies/contractors. Their ability to compete with these companies show that increased size often leads to a lot of waste both within the company and in the bureaucratic decision structure. Large isn't inherently bad, until the only competitors are also large. It then becomes the bigger the better. Now that smaller guys are able to successfully enter the field, it make them reevaluate their structure. In the end, not size, but efficiency is key. Funding still remains the medium to get there.

<comment><USER3> Musk, Masten, Blue Origin, Firefly, XCOR. There's really quite a lot of innovative rocket companies out there now. A lot of them are working on similar or complementary problems, and innovating while they do it. I'm excited to see not only what they produce but what fruits are born from follow-on innovators.

<comment><USER7> Yeah, remember when Armadillo used to be a cool kid on the block?

<comment><USER2> Not sure if you caught the interview but John Carmack recently said he'd still love to re-visit it, but he held firm to his "10 years, that's it" plan. He said it was "binary" \- didn't make it, close it down. If you did catch that, then sorry for being redunant!

</comment></comment></comment></comment><comment><USER8> I've heard of other small rocket companies using alcohol and lox as the fuel/oxidizer. Does anyone know if that is a stand-in for "real" fuels (e.g. RP-1 or H2) that they'll switch to after getting contracts or if they plan on using an alcohol-fueled engine as part of their strategy?

<comment><USER9> I've heard of planning to use alcohol - ethyl alcohol - as fuel for Kliper spacecraft in RKK Energiya. Reminding that Soyuz capsule still uses hydrogen peroxide as its RCS fuel.

So alcohol isn't that much of "non-real" fuel.</comment></comment>


Germany turns up pressure in suspected US spy case - <AUTHOR> http://america.aljazeera.com/articles/2014/7/6/germany-us-spy.html <comment><USER2> As a German, I find the German reaction really pathetic.

No, don't ask somebody for assistance who has just proven (again) that you can't trust him on that level.

Do your own investigations, and find out who was involved. If any of the involved people were US diplomats, expel them from the country (and escalate to the UN? dunno if that's done). If not, go the normal route through the justice system.

On a political level, decouple German intelligence agencies stronger from the US ones, and drive out as much US intelligence as possible.

<comment><USER3> The reason they don't do it, in spite of nearly everyone [1] distrusting the US gov't, makes me wonder what kind of leverage the US secret services have.

It also lends some credence to the "Germany was never really souvereign" theory.

[1] Just check the comment sections in the major German newspapers.

<comment><USER4> Non-Souvereignty is largely regarded as a wild conspiracy theory. And really, what kind of evidence is there?

Inevitably, signs of "foreign control" turns out to be some form of competition, cooperation, trade or just plain common interests.

What counts more is that Germans are allowed to say anything they want, there is no evidence of tampering in elections, the press is free and extensive, and people can largely do as they please. Nothing is ever perfect, but claiming US sovereignty over Germay is just plain stupid.

<comment><USER5> It is not plain stupid. It's actually a good opportunity to figure out what the Grundgesetzbuch is (yes, it is actually not a valid 'constitution') Even Scheuble said the sovereignty issues went into 'ad absurdum' since ww2. There is contract after contract after contract. Germany is in so much need of a rewrite of its law books. Everything is corrected by extensions and special rule. The amount of paperwork germans produce is INSANE and should easily push someone to think "Wait there is something f'ed here".

\- Say anything they want: Unless you mention the H with the J's... and _cough_ Horst Köhler _cough_

\- No evidence of tampering in elections: mmmmmmh there are always issues in the east and there is always something coming up in small districts or states. They are not major but important nonetheless (Read: Local press)

\- The press is free and extensive: LOL!!!!!!!!! Axel Springer and Spiegel dictate the opinion here, everyone else is a jew-baby-eating holocost denier.

\- people can largely do as they please: yes, if they can afford a lawyer to help them with the paperwork.

Not getting into this stuff and just accepting everything would be plain stupid.

</comment></comment></comment></comment><comment><USER6> Well, it was well known in government circles (and beyond) that the US are spying on everyone including their allies, so the fact that they paid a mole in the German secret service shouldn't have been too surprising to the German government.

The fact that he got uncovered and that the whole affair got public is a serious problem for Angela Merkel though: The German public already perceived her as way too soft towards the US during the latest NSA affair, so if she doesn't act this time she will lose a lot of goodwill in the German population. Judging from her recent media appearances, it seems actually likely that she will act in one way or another.

A probable "retaliation" could be to cancel the free trade treaty that's currently being negotiated between the US and the EU (and which, like most EU projects, depends heavily on Germany's consent), which would be a huge economic loss for the US (and to th EU as well of course). So, although this move was "business as usual" for the US, it could have pretty serious consequences for them. Makes me really wonder if the return-on-investment of the current US surveillance strategy is actually positive, or if it will result in a huge loss of economic power and trust for them.

<comment><USER7> > which would be a huge economic loss for the US

LOL, I hope you're not being serious. The only ones TTIP and friends are going to benefit is Big Capital and American producers of chlorine-treated chicken. No thanks, it's enough you fuck up your own country, no need to fuck up Europe too.

<comment><USER6> Well, according to the E.U. the treaty could generate 100 BN € in revenue and more than 1 million jobs both in US and EU, so even if those numbers should be off by a factor of two it's still pretty big...

[http://ec.europa.eu/trade/policy/in- focus/ttip/](http://ec.europa.eu/trade/policy/in-focus/ttip/)

<comment><USER7> Sorry, but I rather lose a million jobs than exposing my country to lawsuits because a democratic decision interfered with the business of some big company.

</comment></comment></comment></comment><comment><USER8> Or it's just another political statement to gain/retain voter support, while everything (US-german collaboration regarding mass surveillance) will go on as before.

Seriously, if Germany wants to make a statement, it can start by banning all NSA listening stations on German soil.

<comment><USER9> But then where would we get most of our sigint from, if not from the NSA? Its not like we have those capabilities ourselves. But I agree that Germany is starting to look a little.... foolish, but there is no easy way out for us. We need the USA more than they need us.

<comment><USER10> Apparently, most of the data NSA collects is useless. And even _with_ that data, other intelligence agencies (read: other countries') are often better informed than the Americans.

Having the most amount of data is not the same has having the best intelligence agency. How can data be useful if you don't know what it's for?

German intelligence is likely more sophisticated than American intelligence.[0] Of course, as with most European intelligence agencies, they do have several centuries of advantage. It took CIA quite a while to figure out not see world politics in a pure East vs West picture. You cannot build that amount of experience overnight.

Do you think the KGB outmanoeuvred the CIA at every turn because of a bigger budget or lack of restrictions? Nay, KGB relied heavily on 600 years of espionage experience. Experience that used to mean the life or death of several European states.

Europe may have granted their former colonies independence, but the experience gathered in our years as masters have not been for naught. It is not without reason France knows central Africa like its backhand.

USA may have more data, because they have the technical knowhow and capability. But they still lack the experience. The relationships between European and American intelligence agencies are certainly mutually beneficial.

CIA's best kept secret is how little they know.

[0] Of course, there will often be the occasional embarrassing story that would dispute this claim. But don't let these few stories fool you.

<comment><USER11> >German intelligence is likely more sophisticated than American intelligence.

Doubtful. German intelligence is probably as effective as Wally from Dilbert. However, shelving TTIP and/or expelling the US ambassador would make a statement.

And of course - in the long run - not sitting on our asses but building and effective intelligence service ourselves.

<comment><USER10> As Tomte points out, this is largely a guessing game we are playing. How can we _really_ know one way or the other?

But I concede, German intelligence is likely the weaker link in European intelligence agencies (and weaker than American as well), not from lack of skill or knowhow, but a political inability to pursue it. Germany's recent history has left Germans rather on the unfavourable side of intelligence agencies and surveillance. I would even imagine the Allies imposing restrictions on the Germans following the Second World War.

<comment><USER12> One odd thing about German intelligence - they have their own set of Russian launched synthetic aperture radar spy satellites:

[http://en.wikipedia.org/wiki/SAR-Lupe](http://en.wikipedia.org/wiki/SAR-Lupe)

Germany has the synthetic aperture radar birds and France runs optical satellites.

I'd love to know who they spend most time watching.

</comment></comment></comment></comment></comment></comment><comment><USER13> I'd say Germany is merely posturing with the US in order to win a seat on the "Five Eyes" spying alliance.

Angela Merkel eyes place for Germany in US intelligence club - [http://www.ft.com/intl/cms/s/0/e2492a3a-3d7a-11e3-9928-00144...](http://www.ft.com/intl/cms/s/0/e2492a3a-3d7a-11e3-9928-00144feab7de.html?siteedition=intl)

US lawmakers push for German entrance to Five Eyes spy alliance - [http://www.dw.de/us-lawmakers-push-for-german-entrance-to- fi...](http://www.dw.de/us-lawmakers-push-for-german-entrance-to-five-eyes- spy-alliance/a-17246049)

<comment><USER14> I'd say Merkel is definitely on US's side, probably even in this case. Hopefully, the German people and government as a whole, aren't.

</comment></comment><comment><USER15> Merkel doesn't care that much and she --even though I hate to say it-- is right that we shouldn't. This spying case isn't a big deal. It doesn't hurt Germany. Also the spying on her phone last year. She didn't really care all that much. After all, USA is the biggest partner of the EU/Germany. Germany can't afford a dent in the relationship with the US. It's the US who's providing security to most of the western world. Who's supposed to protect us from Putin? The NATO?

The biggest fear for Merkel is twofold:

\- Industry espionage. This would attack Germany at what they're best at and be huge problem. USA has been lucky to not be caught about that (in Germany).

\- The much bigger problem for Merkel is however the growing Anti-Americanism in Germany. There has always been a good amount of it. But mostly, Germans see the US as a partner. There is in huge decline and it's a growing problem. Germans are much more serious about their privacy than Americans and the spying scandal didn't help America. Merkel also knows that she has to listen much more to the German public than for instance Obama has to listen to Americans. Germany has a very well functioning Democracy and any pressure from the public will quickly result in resignations or losing the next election. Germany has done this before: Kohl's affair got his party out. The FDP got thrown out of the parliament last year. You can quickly go from 40% to under 20% in Germany. Due to the many US scandals in the last 2 years, Germans see America very very skeptic these days. Der Spiegel yesterday's issue has some numbers: Who should Germany work together with? USA: 56%. Russia: 53%.

If you read many of the forums in Germany you'll see the growing dissatisfaction with the US as a partner. And more and more understanding for Putin these days.

My point of this post is: What this means it that if USA continues to bully the German people, then Merkel will be forced to take action and do something that she doesn't actually want to. She knows very well that America is extremely important and without a good relationship things will get much tougher in Europe/Germany. After all Germany is benefiting from the huge security the US provides to us. But Germans don't think that far ahead and only see the bully in America these days. I hope it doesn't get this far that Merkel is forced (by the German people/media) into getting distance from America since it would hurt both, Germany and the US. I'm very certain that Obama know that Merkel will always be his friend. But I'm not so sure if he realizes that the German people can make Merkel do something that she otherwise wouldn't do.

America: Watch out how far you take the bullying. It might just happen that the next generation of Westerners will end up hating you in 10-20 years down the road. And then, you will have no friends left but only enemies. What Obama and America's government does can be very dangerous for America in the future.

<comment><USER16> >After all, USA is the biggest partner of the EU/Germany.

The US is not just Germanys' biggest partner - it controls Germanys' sovereignty. The German intelligence services are all run from Washington. When Merkel says 'it does not matter', its because its really not relevant that America is spying on Germany: its allowed to. Germany lost WW2, and has not had a restoration of the sovereignty of its intelligence services in its constitution. That part is still held by the occupying power.

<comment><USER17> Didn't the 4+2 treaties restore full sovereignty?

<comment><USER18> On paper. But the 2+4 treaty is mostly Soviets leave, NATO stays and expands.

<comment><USER19> So what you are actually saying is, yes, Germany has full sovereignty.

Please don't spread this bullshit. There is (mostly) mutually beneficial strong cooperation with a power-differential. That's all. Stop spinning your dumb conspiracy theories.

<comment><USER16> Germany does _not_ have full sovereignty and won't, ever, until a Peace Treaty is signed and ratified. America won't allow that to happen because then it'd have to pull out all of its troops - and in case you didn't know, Germany is full of American troops and other military-industrial resources.

Germany is, at most, a puppet state - a model for what America had hoped to pull off in Iraq, Afghanistan, Libya, and so on ..

<comment><USER18> My question is: If Germany is still occupied, what is it that it can not do?

<comment><USER7> Stand up to the shit the NSA is doing. Eject those fucking bastards who operate the NSA listening posts in Germany.

Seriously, everyone who works for the NSA has lost all my respect. You're undermining civil rights for everyone including yourself.

<comment><USER19> You do understand the difference between power differentials combined with different priorities and coercion by force?

</comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER20> Merkel may possibly know a lot about spying. Who would have thought?

Did Merkel work for the Stasi? [http://ireport.cnn.com/docs/DOC-317907](http://ireport.cnn.com/docs/DOC-317907)

The past of the current German president may not look much better (IM Larve)

Anyway, should anything of this be true, the top German leader may be tremendously vulnerable for blackmailing.

</comment><comment><USER4> The incompetency involved in this case almost rules out CIA involvement. Let's reserve judgement until more details are known.

</comment><comment><USER21> As a German I don't see this as an issue. Some German politicians have deep connections to enemy states, so why wouldn't the NSA spy on them? It's in our best interest even, because those politicans are a danger to Europe and Germany itself. You can also see the problem with Germany and France not behaving as allies of the USA in the war against Russia.

<comment><USER22> _As a German I don 't see this as an issue. Some German politicians have deep connections to enemy states, so why wouldn't the NSA spy on them? It's in our best interest even, because those politicans are a danger to Europe and Germany itself._

As a German I very much see that as an issue. If there indeed are polititions having "deep connections to enemy states" (who do you mean?), I want the democratic process to handle that, not the intelligance agency of another state. What do we need a parliament for, anyway, if you think a practically unregulated third party is the right way to handle domestic discourse?

<comment><USER21> We need it because Germany has shown it is unable to do the right thing or even act in its own interest without external help.

</comment></comment></comment><comment><USER23> The conspiracy theorist in me tells me that this might be a staged drama by US-German authorities to instill confidence in German citizens. Or may be to deceive Russia.

<comment><USER24> "Never attribute to malice that which is adequately explained by stupidity."

<comment><USER23> Well stated, who coined this one?

<comment><USER24> [http://en.wikipedia.org/wiki/Hanlon's_razor](http://en.wikipedia.org/wiki/Hanlon's_razor)</comment></comment></comment></comment>


The Full-Time Job Is Dead - <AUTHOR> https://medium.com/backchannel/the-full-time-job-is-dead-b9528bda1c87

<comment> norea-armozel This change in employment practices would be fine if it accompanied a reduction in the cost of living that comes with the down time between jobs. But it seems the reality is that it's more likely to create a permanent underclass of skilled laborers who have to live from job to job (or task to task) to maintain a living. Essentially, it's the McJob taken to its logical end.

</comment><comment><USER2> The salaried employees of uber and airbnb have full time jobs.</comment>


Frama-C is a suite of tools dedicated to the analysis of software written in C - <AUTHOR> http://frama-c.com/what_is.html

<comment><USER2> I like Frama-C a lot in theory, though in practice I found it hard to use except on very small code segments.

When its unable to prove a range the feedback you get from the solvers is inscrutable enough that its very hard to figure out what additional data it would need to satisfy the analysis. (Sort of like parsing C++ compiler template related errors)

I'd hoped that language features like the typestate stuff that used to be in Rust would someday make the work required to use sound analysis tools in production code smaller. I'm not sure if much thought has been given to what kinds of accommodations languages could give to ease static analysis while still being programmer friendly.

It seems that newer languages have actually moved away from analysis friendliness in some respects, however. E.g. in C a signed overflow is always a bug so if analysis can prove one is possible you have something to fix. Several modern languages have defined signed operations to wrap and so that obvious safety test is no longer available. (You could define in your own code that it should never wrap, effectively writing in a subset of the language, but as soon as you call into third party code you never know if an overflow was intended and safe or not— not without extensive analysis)

<comment><USER3> > I'd hoped that language features like the typestate stuff that used to be in > Rust would someday make the work required to use sound analysis tools in > production code smaller. I'm not sure if much thought has been given to what > kinds of accommodations languages could give to ease static analysis while > still being programmer friendly.

Well, since the Rust borrow check is basically a static analysis that's always on and is required to pass for the compiler to emit code, we've put a lot of thought into how to make it as programmer friendly as possible. The final trick that seemed to got it to fall into place was restricting data to only one mutable reference at all times—this was a restriction that's easy enough to understand and can be readily explained through error messages and tutorials. There's still a learning curve, of course, but I think we've got the system down to a reasonable level.

<comment><USER2> Right, the borrow checker does great things. But memory safety is only one aspect of program correctness— though a universal and very important one.

If a program does anything important, if it handles secrets, if it enforces invariants ("the robots arm must not be out of the safe area"), etc. then other aspects of the programs logic may be just as safety critical as memory safety. Frama-C can prove other things about program saftey: this calculation cannot overflow, this error state can never be reached, this operation will complete within X steps... even if the results of non-safety don't result in anything to do with memory errors.

Some of the programmers expectations can be extracted from the program— signed integers won't overflow, loops (unless otherwise annotated) will always terminate, pointers will not be extended outside of their objects, a pointer to an integer won't be called as a function pointer, behavior will not depend on the order function arguments are evaluated in, etc. Some of the expectations must be expressed as assertions.

Once as many of the programmers expectations are understood the analysis needs to know the invariants that allow them to be true. Some of these can be extracted, some must be asserted.

The gap that exists today is that a lot that could be extracted (e.g. by another programmer reading in a context free way, with high probability of success) can't be soundly extracted because there is a lot of technically valid behavior which is just usually unlikely to be what anyone intended. This means that anyone attempting to apply tools like frama-c has to spend a lot of time making the implicit assumptions explicit with assertions. Thats why I was saying that something like making singed overflow defined may be a step backwards because it takes a whole class of "you couldn't possibly have intended this behavior" back to "maybe you meant this".

<comment><USER3> Sure, I totally agree that there are many other invariants that you might like to prove. Many of them require full-on dependent typing—not going there for now is a choice we made to make the language approachable. (See your sibling comment for how difficult it is just to get memory safety!) But I completely agree with you that there is more to be done.

</comment></comment></comment></comment><comment><USER4> It would be good to hear other HN:ers experience with various static analysis tools for C.

I have had good experiences with Flexelint (PC-Lint). It does not attempt to deeply analyze control flow, more like compiler additional warnings. It flags a lot of common mistakes and can basically turn C into a more strictly typed language. I feel a lot more confident in C code if I know that it passes lint, since it warns if you try to mix unsigned and signed ints, cast away const, call functions with wrong types etc.

Like many static analyzers it takes some work to set it up, and tune which warnings you actually car about. It is definitely business-priced and feel a bit old (although command line tools age well.

The is a clear lack of good open source tools. I tried all i could find, but Splint was the only one that would flag switch-cases without break. It was last updated in 2010.

</comment><comment><USER5> One feature you can start using right now: prove an assertion with the WP plugin. [1] It's especially useful to prove the absence of some undefined behaviour, bounds on variables, or invariance conditions.

[1] [http://frama-c.com/wp.html](http://frama-c.com/wp.html)

</comment><comment><USER6> It is very handy - [http://xvilka.me/frama-c.png](http://xvilka.me/frama-c.png) \- screenshot of the integer overflow found.

<comment><USER7> I really like your config :)

</comment></comment><comment><USER8> The only option for windows is manual compilation using a POSIX library.

Any suggestions for a similar tool?

<comment><USER9> Cppcheck - [http://cppcheck.sourceforge.net/](http://cppcheck.sourceforge.net/)

<comment><USER8> Thanks, I just tried it and it found an assignment in an assertion that the compiler didn't warn because it wasn't an if statement.

I ran it over a couple of old finished projects and it found a problem in each one. Awesome.

Unfortunately it misses a class of errors memcpy would do,( similar to heartbleed ) , if copy size is determined at runtime.

</comment></comment></comment><comment><USER10> What would this say on the OpenSSL code that had the Heartbleed bug? (Edit) this: [https://news.ycombinator.com/item?id=7571506](https://news.ycombinator.com/item?id=7571506)

<comment><USER11> Frama-C does not say much, when do don't tell it what it should do. It needs to reason over symbolic facts, C code is not enough. It's not just another simple static code checker.

You can look at the Frama-C blog what it does with a major openssl competitor, polarssl. [http://blog.frama-c.com/](http://blog.frama-c.com/)</comment></comment>


Bela: An Embedded Platform for Low-Latency Interactive Audio - <AUTHOR> https://www.kickstarter.com/projects/423153472/bela-an-embedded-platform-for-low-latency-interact <comment><AUTHOR> Quite exciting I think. This is an embedded module built on the BeagleBone Black, designed for audio synthesis and processing, with real-time Linux, support for Pure Data patches, and audio and sensor I/O. It comes from Andrew McPherson's lab, the same as responsible for the TouchKeys augmented piano keyboard ([http://www.eecs.qmul.ac.uk/~andrewm/touchkeys.html](http://www.eecs.qmul.ac.uk/~andrewm/touchkeys.html)).</comment>


GNU Emacs 23.2 released - <AUTHOR> http://permalink.gmane.org/gmane.emacs.announce/17

<comment><USER2> The NEWS file <http://www.gnu.org/software/emacs/NEWS.23.2> is more helpful.

* CEDET <http://cedet.sourceforge.net/> is now part of emacs(!!!)

* RMAIL now uses mbox

<comment><USER3> __js.el is a new major mode for JavaScript files.

I think js2.el (Steve Yegge) was combined with javascript.el to make a new mode. Might be interesting...

<comment><USER4> No, it's espresso, not js2. But don't worry, that was the only sane Javascript mode; js2 is like its own program, completely independent of Emacs. Cool, but useless for real work.

espresso/js actually works like Emacs, and it doesn't try to treat Javascript as a dialect of C anymore.

<comment><USER3> Useless for real work? I never saw negative comments from js2 users...

I remember it was similar to nXML in having its own parser... do you think nXML is badly engineered or useless too ?

I wrote a mode inspired by your Stylish for Lua one day. I wish there were more editors that would let you do that kind of thing...

</comment></comment></comment></comment><comment><USER5> Mac OS X users can get a binary at <http://emacsformacosx.com/>.

<comment><USER6> Thanks for that link. I spent some time late last night comparing this new _pure Emacs_ release with _Aquamacs_. I have been a happy _Aquamacs_ user for a long time but I will probably switch because of the faster startup times and cleaner looking interface. When _Aquamacs_ is released with an update, I would like easier options for simplifying the look and feel (e.g., having to hide the button bar, etc.)

BTW, really off topic, but does anyone know how to bind the speedbar to the main frame window instead of being in a separate frame window?

<comment><USER7> As a tip, if you enjoy quick startup times, you might want to try running emacs in daemon mode. Just fire up a emacs --daemon instance, and you can then use emacsclient to instantly connect to it.

<comment><USER8> You can also put (server-start) in your .emacs config.

</comment></comment></comment></comment><comment><USER9> _The maximum size of buffers (and the largest fixnum) is doubled. On typical 32bit systems, buffers can now be up to 512MB._

This limited buffer space has long been a criticism of mine and an often-used point I make when I choose to play the Holy War game between vim and emacs. 512MB is still a weak and arbitrary limitation (vim just uses up your memory), but this is much better than it was.

<comment><USER10> Can you give me a situation where you would need more space ?

<comment><USER9> \- Viewing/modifying a fasta file containing human chromosome data

\- Extremely large log files

Why not use less? Because it's ugly and does not allow me to edit or copy specific sections out. I like having the full power of a good text editor at my back.

I have brought this concern up before, and the excuse I heard was, "Well, you should not have to work with files that large." Seems someone in emacs-land disagrees; now you can play with files up to 512 MB on a 32-bit system! If there is a legitimate use case for, oh, 500 MB, we can imagine a use case for 2 GB. The world is moving on; we aren't playing with 64 KB systems any more, and data keeps growing.

In 2010, our text editors still have hardcoded memory limits? (I understand emacs's architectural reasoning for it -- and that is a choice.) IIRC, DOS 6.2's Edit could handle large files; it accomplished this with a partial- loading/paging trick, rather than actually loading the entire file in memory.

So yes, I would like to and have enjoyed opening files of large size. Admittedly, I have to wait a bit for the I/O to catch up! :) I also have to be conscious of my memory usage, since I am unaware of any paging mode in vim (or emacs). I expect, on average, to have the option to open a file of at least 3 GB size -- and that is without taking advantage of swap. Next year, I expect more.

I know it is not a common desire, so I do not blame anyone for imposing an arbitrary limit other than to say "nyah nyah; I am free".

<comment><USER11> > I understand emacs's architectural reasoning for it -- and that is a choice.

I think the choice they make is to spend their very limited time on more useful features. I'm sure many of the core Emacs developers would be very happy if someone would fix this limitation. It would be a very invasive change, a fair amount of work.

<comment><USER4> Any change on 32-bit machines will require special CPU instructions, massive Lisp slowdowns, or massive integer math slowdowns.

Considering you can't even buy a new 32-bit machine anymore, however, I don't really see this as a major problem.

<comment><USER12> >Considering you can't even buy a new 32-bit machine anymore, however

Netbooks.

<comment><USER13> Most netbooks that have come out in the past 6 month have a 64-bit CPU. Only the old atom N2xx series is 32bit, and they are rapidly being phased out.

</comment></comment></comment></comment></comment></comment></comment><comment><USER8> Great summary of clipboard and mouse related features here: [http://www.reddit.com/r/programming/comments/c1gsi/emacs_232...](http://www.reddit.com/r/programming/comments/c1gsi/emacs_232_released/c0pm5aa)

</comment><comment><USER14> From NEWS.23.2: "The pointer now becomes invisible when typing.Customize `make-pointer-invisible' to disable this feature."

<comment><USER15> You might also like mouse-avoidance-mode. I've got it set to 'exile.

</comment></comment><comment><USER16> Can someone very briefly explain the popularity of emacs and vim among programmer types? I'm aware that they're unix based text-editors with some degree of reprogrammability... but what's the big deal?

<comment><USER17> It's a fair question. Emacs is one of few editors left that makes it possible to work on multiple files at once without taking your hands off the keyboard. No fumbling with the mouse. Watch someone who has mastered Emacs edit some code and you'll understand its appeal.

<comment><USER16> Hmm, I'm still not quite sure I 'get it.' For instance, your comment, 'no fumbling with the mouse' confuses me. I've always viewed the mouse as something that _saves_ time, a shortcut to where you want to go or what you want to do. Especially on a Mac with non-maximized windows and Exposé mapped to a mouse button, I've never felt like I was 'fumbling.' I guess I'll ask an Emacs user to demonstrate next time I meet one.

<comment><USER15> Exposé breaks down when you have a hundred buffers open, though. iswitchb cuts through that like a bullet through butter.

The mouse is better for some things (especially relative/spatial stuff), and the keyboard for others, but interfaces that make you switch back and forth are clearly problematic. Rather than popping up dialog boxes and alerts, Emacs displays results (such as compiler output) in _another buffer_. If it needs immediate input, it uses the minibuffer, a one-line buffer at the bottom of the screen.

In either case, its full text-editing functionality is available. You can run a directory browser/editor, a web browser, shell, interpreter, e-mail client, irc client, etc., and it's just another text window.

FWIW, Marco Baringer's SLIME screencast ( <http://common- lisp.net/project/movies/movies/slime.mov> ) is a pretty good example of proficient Emacs usage. That convinced me to try Emacs after using vi for several years.

<comment><USER16> Ok after watching that link and reading these comments i'm starting to understand a little. I installed Aquamacs (other emacs clients were too ugly IMO). I can see that emacs perhaps had a lot of features Visual Studio had BEFORE vs, and that it's a stable, multi-platform, multi-language environment. I can see also that some of the text editing/formatting functions would probably work better than what I currently use Excel for. I can see the attraction of an uncluttered dashboard/interface too. And extensibility. But as a beginner I can't yet relate to this 'context-switching' problem and the appeal of running all sorts of applications inside a text editor.

<comment><USER15> No problem. I'm not trying to convince you one way or the other (heck, I use vi too), but I figured a video might help.

Also, for you or anyone else reading this thread, <http://emacswiki.org/> is the place to go for info.

</comment></comment></comment></comment></comment></comment><comment><USER18> Nice to see that CEDET is now included.

<comment><USER19> I can't seem to get it to work, though. The information on the CEDET website for setting things up doesn't seem to be valid anymore.

Specifically:

      (global-ede-mode 1)                 ; Enable the Project management system
      (semantic-load-enable-code-helpers) ; Enable prototype help and smart completion
      (global-srecode-minor-mode 1)       ; Enable template insertion menu

Throwing in (require 'cedet) doesn't seem to work either.

<comment><USER20> I'm having the same problem. I searched the code for "semantic-load-enable- code-helpers" and it isn't in any of the .el files in any of the directories under "lisp". Would be nice to try this out, but I'm too busy to get this going today (I'd love it if someone else solves this tho :-)

</comment></comment></comment><comment><USER21> Do they have a C# mode yet, or is that still p[r]etty impossible to do?

<comment><USER22> <http://www.emacswiki.org/emacs/CSharpMode>

<comment><USER23> I may not have the latest version, but I find that sometimes this mode has issues with syntax highlighting, especially around comments.

Not a deal breaker for me, though.

</comment></comment></comment><comment><USER24> They are still using MD5 checksums?

<comment><USER25> What should they be doing?</comment></comment>


Ask HN: What's your most imp life lesson that you wish learned 10 years earlier? - <AUTHOR> Inspired by Julie Zhuo's tweet - https://twitter.com/joulee/status/1214668157085863936? <comment><USER2> Lesson learned years after middle- and high-school: most everybody (even those you know) is having sex (but you aren't)!

</comment><comment><USER3> Learn to be write well early in career.

Journaling helps.

</comment><comment><USER4> Invest in BitCoin early!</comment>


We should be wary of blaming 'overpopulation' for the climate crisis - <AUTHOR> https://theconversation.com/why-we-should-be-wary-of-blaming-overpopulation-for-the-climate-crisis-130709 <comment><USER2> I disagree with reasoning of this article. Not inequality is the reason for our economic woes. If all people on this earth would be living in conditions of the first world, our resource problems would be significant. Of course there are the big corps with a disproportional impact, but these big corps produce because they have consumers.

> the consumption of the world's wealthiest 10% produces up to 50% of the > planet's consumption-based CO₂ emissions, while the poorest half of humanity > contributes only 10%

Without these inequalities the percentages would look better, but certainly not the absolute environmental impact. On the contrary...

What I agree this topic could increase the inequality and people least responsible could suffer the most. So until this inequality isn't addressed, refusal to take part in this discussion might not be a bad choice. Any conclusion and measures here would only affect later generations if you don't want to start a war and kill a lot of people.

Maybe we get lucky and we are we will refocus this consumption, have better technologies or more sensible policies that we don't have to.

</comment><comment><USER3> Overpopulation is a real, critical issue. Even if it does not directly relates to climate change, it is in big part what drives our impact on the environment.</comment>


Sandman-Lite Version 1.4.0 Released - <AUTHOR> https://github.com/alexanderepstein/Sandman-Lite <comment><USER2> If it meets the guidelines, this might make a good 'Show HN'. Show HN guidelines: [https://news.ycombinator.com/showhn.html](https://news.ycombinator.com/showhn.html)</comment>


Ask HN: Any recommendations for a Apache log analyser? - <AUTHOR>

I'm looking for a log analyser for Apache possibly free or commercial if it's good .. i'd love to hear some suggestions from folks on here ..<p>thanks <comment><USER2> How about Splunk (splunk.com)? I believe they do have a free version.

<comment><AUTHOR> Thanks a lot for that tip.

Some else just pointed me to the same site. They have a 500MB/day limit for the free version but that'll be more than enough for me at the moment.</comment></comment>


Revisiting an Explorer's Northwest Passage Disappointment After Nearly 230 Years - <AUTHOR> https://www.atlasobscura.com/articles/mackenzie-northwest-passage-disappointment-river <comment><USER2> His travel to the edge of the arctic ocean might not even be Alexander Mackenzie's most interesting journey (fascinating though it was)

He reached the Pacific ocean by land a full 12 years before Lewis and Clark. He also took far less time to complete the journey since the network of voyageurs in what would become western Canada meant he could start his journey in Alberta rather than much further east in St. Louis.

But if you want to do further reading on someone wandering about in crazy arctic conditions, check out John Rae. He explored much of the arctic coast on foot (!) and discovered the remains of the doomed Franklin expedition. Also managed the minor feat of proving the existence of the north west passage in the process. He would be remembered as one of the greatest explorers of all time if the passage proved remotely commercially navigable, instead he was relegated to the minor pages of 19th century history. It didn't help Lady Franklin was so insulted when he reported to the Admiralty her husband's expedition likely resorted to cannibalism based on reports from local Inuit.

<comment><USER3> Will do.

</comment></comment><comment><USER4> Perplexing that there's no modern map with Mackenzie's route in the article. Hard to make sense of the narrative.

<comment><USER5> Agreed, though it is possible to follow along using Google Maps with some difficulty. I actually enjoyed tracking it myself to be honest.

They started at Lake Athabasca, made up their way up Slave River to get to Great Slave Lake. Then they took the Mackenzie River through to the river delta at the Kendall Island Bird Sanctuary. Garry Island is just past the delta.

</comment></comment><comment><USER3> This is a ridiculously impressive feat. ~1200 miles north, starting about 500 miles further north than the vast majority of people in Canada live. Not accounting for conditional differences, this is like canoeing from the Canadian border to Mexico.

<comment><USER2> The distances voyageurs could cover in a day was incredible. Even the many portages did little to slow them down.

When they didn't have to haul 3 tons of trade goods they could really fly, like when travelling with Mackenzie looking for the northwest passage.

George Simpson (later HBC governor) made his way from the shores of Hudson Bay to the mouth of the Columbia River by canoe. He did use a horse for the Athabasca pass, but that's hardly cheating. He set a record by doing it in 80 days with a light load. For 1824 that was incredibly fast since it's about a 4000 km trip.

<comment><USER3> You have an interesting point. I hadn't really thought of that in quite a while, given that it was core curriculum in my early years. Using other professions like construction or moving for examples of how your body becomes conditioned for the job, the voyageurs must have been beasts of men. The lumberjacks of the river.

</comment></comment></comment><comment><USER6> I was wondering how the arctic melt changes our view on the northwest passage. Was it really ice-free enough in human memory such that it could have been a myth?</comment>