Slashdot Mirror


Interviews: Ask Alexander Stepanov and Daniel E. Rose a Question

An anonymous reader writes "Alexander Stepanov studied mathematics at Moscow State University and has been programming since 1972. His work on foundations of programming has been supported by GE, Brooklyn Polytechnic, AT&T, HP, SGI, and, since 2002, Adobe. In 1995 he received the Dr. Dobb's Journal Excellence in Programming Award for the design of the C++ Standard Template Library. Currently, he is the Senior Principal Engineer at A9.com. Daniel E. Rose is a programmer and research scientist who has held management positions at Apple, AltaVista, Xigo, Yahoo, and is the Chief Scientist for Search at A9.com. His research focuses on all aspects of search technology, ranging from low-level algorithms for index compression to human-computer interaction issues in web search. Rose led the team at Apple that created desktop search for the Macintosh. In addition to working together, the pair have recently written a book, From Mathematics to Generic Programming. Alexander and Daniel have agreed to answer any questions you may have about their book, their work, or programming in general. As usual, ask as many as you'd like, but please, one per post."

80 comments

  1. Early Soviet Computing? by eldavojohn · · Score: 4, Interesting

    Alexander Stepanov, I have never had a chance to ask someone as qualified as you about this topic. I grew up on the opposite side of the Iron Curtain and have constantly wondered if (surely there must have been) alternative computing solutions developed in the USSR prior to Elbrus and SPARC. So my question is whether or not you know of any hardware or instruction set alternatives that died on the vine or were never mass fabricated in Soviet times? I don't expect to you to reveal some super advanced or future predicting instruction set but it has always disturbed me that these things aren't documented somewhere -- as you likely know failures can provide more fruit than successes. Failing that, could you offer us any tails of early computing that only seem to run in Russian circles?

    If you can suggest references (preferably in English) I would be most appreciative. I know of only one book and it seems to be a singular point of view.

    --
    My work here is dung.
    1. Re:Early Soviet Computing? by sconeu · · Score: 1

      Back in the day, Byte did some reporting on the state of Soviet microcomputing.

      --
      General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
  2. ack-nak by Anonymous Coward · · Score: 0

    Compare search technology to genetic programming. Will search technology progress to the point of "Computer -- write me a program that does ..." ?

    1. Re:ack-nak by blue+trane · · Score: 2

      My question is similar: when will programming evolve to use subject-predicate syntax, rather than function-argument?

      Function-argument goes back (at least) to Frege, and his prejudices against subject-predicate syntax (which dominates natural languages). But isn't changePassword(a,b) more ambiguous than "change the password from a to b"? Don't we get an "information gain" effect from using a syntax we are familiar with outside of programming? When you first come to a function-argument command such as (in Oz, which is used in the Paradigms of Computer Programming MOOC) {Push S X}, there is maximum entropy as to whether S is pushed, or pushed onto. "Push X onto S" has no entropy; you know immediately, from the syntax alone, what is pushed onto what.

    2. Re:ack-nak by TobiX · · Score: 1

      Some "real world" programming languages already have that feature. The foremost is Objective C, widely used for programming Apple products, which I believe inherited it from Smalltalk. Compare this Objective C fragment:

      myColor = [UIColor colorWithRed: 127 green:127 blue:127 alpha:1];

      with the equivalent Java code:

      myColor = new Color(127, 127, 127, 255);

      A singular feature of Objective C, as compared with other languages, is that the method signature is composed of all the intermediate words (adverbs or prepositions) in that particular order. For example the method above is referred to as colorWithRed:green:blue:alpha. You must use them in the same order, otherwise you get a compilation error, because you might be invoking an entirely different method. This is consistent with subject-predicate usage in natural languages, where "tell X by Y to Z" may be different from "tell X to Y by Z"

      Other languages, mainly dynamic ones (Python, Groovy, etc.) take a hybrid approach, where you can pass named parameters, but their presence or ordering is not taken into account when choosing which method to invoke. Some of them (Groovy) allow the programmer to give meaning to the position of the arguments, when needed, while others don't.

    3. Re:ack-nak by ChunderDownunder · · Score: 1

      javac references imported classes from the .class(es) rather than, say, a plaintext header file. Java bytecode doesn't typically preserve parameter names*. Hence the only information the compiler sees for Color is a constructor with 4 int parameters.

      * (apparently if you compile with the -g option, for debugging, that info is preserved. Or with -parameters with Java 8)

  3. Search seemingly getting worse over time by TWX · · Score: 2

    This is more for Daniel Roseis, but to what do you attribute the seeming decline in the quality of search results? I used Digital's Alta Vista search engine when it was fairly new and it seemed revolutionary and seemed to provide me with exactly what I wanted. Over time that declined and Alta Vista as it was ceased to be, and Google initially also seemed to provide me with exactly what I wanted. Now it seems like I have to put a whole lot of thought into faking Google into performing a somewhat-boolean-style search for me, and normal boolean expressions themselves no longer seem to work.

    Is this the result of attempting to dumb-down the interface for tailored results, or something else or more insidious? Obviously the amount of content on the Internet is growing, but the computing power to process through all of it is growing too, so I would expect it wouldn't be getting this much worse, this quickly.

    --
    Do not look into laser with remaining eye.
    1. Re:Search seemingly getting worse over time by itzly · · Score: 2

      Could also be the result of companies trying to tune their web pages for search results.

    2. Re:Search seemingly getting worse over time by TWX · · Score: 2

      If it were companies that'd be one thing, but I get explicit search terms that do not appear in the resultant pages, nor do quoted expressions work as well as they used to.

      --
      Do not look into laser with remaining eye.
    3. Re:Search seemingly getting worse over time by MouseTheLuckyDog · · Score: 1

      I was wondering something similar. Often times recent news tends to overshadow search results.

      Let me give a practical example. Grand Jury. proceedings have undergone serious reform since the 70s. In some states a target can demand to appear before the Grand Jury. In some states a No Bill precludes the State from representing the case. In others there must be clear new evidence before a case can be represented. I know one state has a three striges rules for GJ proceedings ( sorry don't remember which).

      The day before the Michael Brown shooting, a search on Grand Jury Missouri would have found several articles on the specific laws to Grand Jury proceedings in Missouri.

      The day the DA announced he would present the case to a Grand Jury, the same search gets hundreds of articles on news story about Michael Brown and Grand Jury proceedings, but it becomes impossible to find those same scholarly articles about the peculiarity of Missouri Grand Jury proceedings. Not even the relevant statutes from the state website.

      What can be done to mitigate this effect?

    4. Re: Search seemingly getting worse over time by Anonymous Coward · · Score: 0

      Does search no longer allow you to negate results containing certain keywords? I.e "grand jury" -ferguson

    5. Re: Search seemingly getting worse over time by TWX · · Score: 2

      In my experience, it's almost impossible to exclude things, as search engines don't want basic boolean functions (ie, NOT, which a minus sign would be) to work anymore.

      --
      Do not look into laser with remaining eye.
    6. Re:Search seemingly getting worse over time by sound+vision · · Score: 1

      It might just be that the ratio of crap to cream on the internet is worse. In 1998, generally you didn't have a web site without something important to say. Or, if it was a personal web site on GeoCities or Angelfire, the nature of the site would be obvious from the URL, not to mention the content and layout. Computing power has been improving, but that doesn't mean search results improve. That requires a better search algorithm which is a different thing entirely.

      For my two cents, I haven't noticed any reduction in search result quality during that time.

    7. Re: Search seemingly getting worse over time by sound+vision · · Score: 1

      Google changed their search quite a few years ago (2010? earlier?) to take boolean operators as more of a suggestion. You can still use them, and they still change the search results, but it would not literally exclude every page with the word "ferguson".

    8. Re:Search seemingly getting worse over time by Headw1nd · · Score: 1

      I think it's mostly a problem of sites repeating each other. So much of the web is just aggregators aggregating other aggregators, adding nothing of value. From the traditional search perspective they look extremely relevant, since they're all in agreement, when in reality they are all equally useless.

    9. Re: Search seemingly getting worse over time by angel'o'sphere · · Score: 1

      I just played with boolean searches on google yesterday or the day before: they did not work at all! (And there is no help available on google indicating that they should work).

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    10. Re:Search seemingly getting worse over time by sound+vision · · Score: 1

      That's one of the major things I had in mind when thinking about "crap" - also auto-generated pages with zero content but lots of search keywords. Try to find lyrics or tabs of some obscure song on the internet, and you'll get a million pages titled "Rainbow Ffolly - Labour Exchange lyrics", all of them saying something like "We don't have lyrics for this song yet..."

  4. Alexander Stepanov's STL by MouseR · · Score: 2, Insightful

    Have you had regret nightmares since unleashing STL?

    1. Re:Alexander Stepanov's STL by serviscope_minor · · Score: 1, Redundant

      Why would he have nightmares? The idea of concepts and separating algorithms and data in that way was completely revoloutionary.

      --
      SJW n. One who posts facts.
    2. Re:Alexander Stepanov's STL by Anonymous Coward · · Score: 0

      Have you had regret nightmares since unleashing STL?

      If I may take the liberty to answer on his behalf based on what he describes in his talks, his biggest regret was to get std::max wrong, and it remains wrong to this day in the STL apparently.

      The C++ standards committee has been very rigid and failed to listen to some of his advice - The only reason STL ever became what it is, is because Bjarne saw eye to eye with Alex and was willing to bend the language to conform to an environment where STL would work well. Thank Bjarne for that!

  5. STL by serviscope_minor · · Score: 3, Interesting

    I'm a huge fan of the STL, and I think the design has stood the test of time amazingly well.

    That said, you now hae a bunch of hindsight. What would you do differently knowing what you know now.

    Also if you were doing it today and using today's languages, how do you think it would differ?

    --
    SJW n. One who posts facts.
    1. Re:STL by Pseudonym · · Score: 1

      Related question: C++ was originally conceived as "C + Simula", but something that is interesting about the STL is how non-object-oriented it is, in particular using no inheritance.

      If we were designing a new "better C" today, one that you'd be happy to implement a STL-like system in, knowing what we know now, would we bother with Simula-style objects at all?

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    2. Re:STL by angel'o'sphere · · Score: 1

      First of all the STL is very object oriented, after all everything is capsuled into a class. Second: ofc it also uses inheritance! Look at iterators e.g.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    3. Re:STL by Pseudonym · · Score: 1

      Merely using information hiding doesn't make something object-oriented. There is virtually no OOAD in the STL.

      (Pun intended; grep for virtual in the C++ standard library some time.)

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    4. Re:STL by angel'o'sphere · · Score: 1

      What has virtual vs non virtual to do with that?
      Regarding OOAD I'm of the opposte opinion, seperation of concerns is IMHO one of the most important aspects os OOAD and that one is certainly met.
      Inheritance and virtual methods are not the only aspects nor the most important ones :)

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    5. Re: STL by catf00d · · Score: 1

      Don't let Stepanov hear you say the STL is object-oriented. He has famously trashed OO, very publicly. Also, where do the iterator's use inheritance?

    6. Re:STL by alphabetsoup · · Score: 1

      STL is actually object-based, rather than object oriented. STL uses classes for encapsulation, but doesn't really use inheritance, and and definitely doesn't use virtual functions, which is what classically means object-oriented. Whatever inheritance is used are more for refinement of concepts rather than object oriented programming.

    7. Re:STL by angel'o'sphere · · Score: 1

      An implementation can not be object based :D

      It is a language that is either object based or object oriented.

      The lack of usage of a language feature is "interesting" but does not define the implementation.

      Also keep in mind that the iterators in the STL _use_ inheritance! Alebit no virtual functions/methods.

      I strongly disagree that virtual methods and/or inheritance makes a system "object" oriented and the lack of it makes it non object oriented. But perhaps that is mainly an academic stand point.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    8. Re: STL by angel'o'sphere · · Score: 1

      The iterators use inheritance to distinguish between forward, backward and random_access iterators.

      The generic algorithms rely on that distinction.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    9. Re: STL by catf00d · · Score: 1

      Ah, you're referring to the inheritance relationships between the iterator tags, not the iterators themselves. The tags are metadata, not objects. The inheritance is a trick used in the guts of the algorithm implementations because C++ doesn't let you overload functions on concepts. You can't use that to claim the STL is object-oriented. You never have to inherit from anything to use the STL, even if you write your own custom iterators.

    10. Re:STL by catf00d · · Score: 1

      STL iterators do not use inheritance. Iterator tags do.

    11. Re:STL by Anonymous Coward · · Score: 0

      Runtime virtual dispatch is what OO is about , either directly by calling methods on base objects or by passing messages to some sort of message hub that dispatches.

      STL is not OO, in fact 90% of the code in the STL is free functions

    12. Re: STL by angel'o'sphere · · Score: 1

      Inheritance is not required to make something object oriented.
      Everything in the STL is a class, so _it is_ object oriented. Even if it mainly where structs it would be.

      Having to inherit to use something also is no definition of object oriented. However you can inherit, if you see so fit.

      I don't use C++ anymore (regularily) ... so perhaps the implementation of the STL has changed. When it was new it used inheritance in the iterator area as there was no other way to make an generic algorithm to accept only certain iterator types.

      I guess with "tag" you mean the "trait" pattern used with templates sometimes?

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  6. C++ by maestroX · · Score: 1

    I remember reading you settled on C++ back in the 90s to implement STL.
    Why the choice for an existing language and not craft your own language?

    1. Re:C++ by Anonymous Coward · · Score: 0

      In a way he did both. C++ itself was enhanced to suit his purposes.

    2. Re:C++ by Pseudonym · · Score: 1

      The first implementation was in Ada. It wasn't the full STL as we know and love it today, of course.

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    3. Re:C++ by maxlybbert · · Score: 1

      He actually did try creating at least one language: look for "Tecton" on http://www.stepanovpapers.com/ (it's in more than one section).

      He also worked in Scheme and Ada before picking C++. He dabbled with early versions of Java, but (I believe) he had already decided "object orientedness is almost as much of a hoax as Artificial Intelligence" so that didn't go anywhere ( http://www.stlport.org/resources/StepanovUSA.html for the quote).

  7. Advices to russian software engineers by Anonymous Coward · · Score: 0

    Alexander Alexandrovich, two questions:
    1. What advices would you give to the younger generation of Russian software scientists and engineers?
    2. Which ways would you suggest to benefit their fatherland?

  8. Successor to C++ by Anonymous Coward · · Score: 0

    I remember you wrote that STL has nothing to do with C++, it was a framework for generic programming and that C++ was chosen for its first implementation because it was less deficient for that purpose compared with other commercial programming languages.

    That implies you'd like to develop a programming language from scratch. Is that so? If so, how is it going?

  9. Good programmer by technocrattobe · · Score: 2

    How to achieve excellence in programming and design ? I am working as a programmer for a year now. but I don't know what i am doing

  10. Russian smarts by TobiX · · Score: 1

    Russian programmers and hackers are famous for being extremely smart. This is also a fame your fellow countryman hold from Chess tournaments and other competitions of the mind.

    In your opinion:

    • Is this true?
    • If so, is it a case of the crème de la crème, say the top 20 best Russian hackers, being much smarter than the top 20 hackers from the rest of the world? Or is it a case of there being many more smart people in general in Russia, compared to other countries?
    • If true, would you attribute it to genetics or to education? Or both?
    • How are Russian universities, compared to American and European ones?

    Thanks

    1. Re: Russian smarts by Anonymous Coward · · Score: 0

      Or is it a lack of respect and lack of law enforcement for cyber offences that breeds the environment. Chinese and russian sites have been goto's in particular for industrial software licensing workaroinds.

  11. GotW #50: vector is not a container by epine · · Score: 1

    Alex: I regard my first encounter with the STL (very shortly after its first public release) as one of the great eye-opening moments in my software development career. Unfortunately, as I'm sure you well know, quality of implementation issues in compiler support for the C++ template idiom cultified (i.e. made cult-like) the deeper principles for at least five (if not ten) years thereafter.

    GotW #50

    I've long regarded the criticism against vector[bool]—I'm not going to fugger with angle brace entitiesâ"not being a container were misguided. Of course, it *must* be a container for reasons of sanity, but to portray the problem as a standardization committee brain fart seems to miss the main point.

    Just as STL introduced a hierarchy of iterator potency (that was the main technical innovation behind the STL, was it not?) one could likewise introduce a hierarchy of container potency. The container we ended up returns interators which promise a dereference operator returning an lvalue (it's been a long time since I've used this terminology) which is why the following statement from the linked discussed is expected to work:

    typename T::value_type* p2 = &*t.begin();

    But actually, of all the uses of containers found in the wild, I highly doubt that more than a small percentage (potentially a very small percentage) exploit the property that interator dereference returns an lvalue rather than an rvalue.

    The net effect is that the standard containers promise us a potency we rarely exploit, yet the burden of this potency is universal. Forsake it in even the smallest way, and you'll be shouted out of the room for non-containerhood.

    We could have handled vector[bool] by changing the standard container to not promise IDLV (container iterators dereference to lvalue). In cases where the programmer goes ahead and tries to do this, he or she obtains a simple syntax error (ha ha ha) and knows to either reformulate the algorithm to not require this property or to go back and add a specification override to the container setting the IDVL property to true.

    With IDVL set, vector[bool] does not specialize.

    With IDVL unset, vector[bool] will specialize.

    Problem solved, except for the language overhead of introducing (and managing) a container strength hierarchy.

    But instead, Herb Sutter decides to write this:

    Besides, it's mostly redundant: std::bitset was designed for this kind of thing.

    Doesn't that attitude make you want to pound your head upon a table somewhere? Seriously, if one repeats that remark 1000 times, we could almost make the entire STL go away (and return to the world we would have had instead had the STL not rescued us from parsimony mass produced.)

    Clearly, there was enough of a pain point in the C++ standarization effort around iterators that the STL gained traction exceedingly quickly (and very late in the day), yet the C++ community is also extremely hidebound about minor pain points, as evidenced by Sutter's explanatory tack.

    Obviously, there were some advantages in demonstrating that the STL approach could achieve performance comparable to C (and in some cases, better than C) in proving that the STL was not just another abstraction gained at the expense of runtime overhead (which all looks fine until five or ten different runtime overheads—however small each of these appears in isolation—begin to interact adversely).

    But very quickly, the initial quality of implementation issues and the quirky (to be extremely kind) limitations of the C++ template mechanisms threw up some major walls in pursuing the underlying ideas behind the STL more extensively.

    So, my question is this, more or less: in retrospect, was the early victory with C++ worth it (it's extremely easy to understimate the value of having a good idea noticed at all), or does the eternal puberty of the C++ STL continue to grate?

    1. Re:GotW #50: vector is not a container by epine · · Score: 1

      Self reply:

      I see in my post that IDLV mutated into IDVL and I mangled an mdash entity into a real mdash in one sentence. Pardon my sloppiness, but I didn't want to miss this opportunty despite feeling a bit rushed.

  12. What's your time like? by mlheur · · Score: 3, Interesting

    How much of your time do you dedicate to computing vs doing other things; what are your other hobbies or is the work you do also your play time?

  13. Memory exploitation and countermeasures .. by lippydude · · Score: 1

    How difficult would it be to eliminate heap overflows, buffer overruns & stack exploits on the current x86 PC compatible architecture?

  14. c++ templates design by nicholas22 · · Score: 0

    Heheh... well, designing c++ templates, in my mind, ranks as low as Java genetics design....

  15. C++ STL compared to other languages by Anonymous Coward · · Score: 0

    IMHO the C++ STL is a great library, and most criticism I've heard of it is more about particular implementations than its design. That said, when you look at other languages' standard libraries (or nonstandard libraries), are there things you wish the STL did differently or missed out on?

  16. Why is Generic Programming often second class? by Anonymous Coward · · Score: 1

    We see many programming languages with at least some support for Generics, but usually as a second class citizen, and often added as an afterthought in later releases, and subordinate to some other programming paradigm. Java is primarily OO, with generics added later. C# is also primarily OO, though with generic support. It took C++ several iterations to get generics, and C++ is "multi paradigm". Go doesn't have generics, and doesn't seem like it will not a while.

    It seems to me like generic programming is sufficiently powerful as a paradigm to not need other paradigms like OO in the same language. In fact, in many ways, OO, which ties together data and alogrithms, seems antithetical to generic programming.

    So, do you see a possibility of a programming language whose primary paradigm is generic programming? Why do language designers not get generics into the first releases of their languages, even now, when the issues would seem to be well known? What would such a language look like?

  17. What is the results of your programming teaching? by xxie24 · · Score: 1

    Alex, I saw some of interesting programming lecture video at A9 lab. What is the outcome of your teaching? Do you think the audiences applied your methodologies in daily programming work?

  18. Indexing for regular expressions. by MouseTheLuckyDog · · Score: 1

    Often times I search for something and I want to search for a regular expression. Is there any technique that allows for indices on such?

  19. "while I am a traditionalist" by Anonymous Coward · · Score: 0

    Dear Alexander

    In this interview, http://www.stlport.org/resources/StepanovUSA.html , you said:

    "I love pasta, prosciutto and Chianti, - while I am a traditionalist, I look much more like John XXIII than Pius XII."

    What did you please mean by this sentence, notably the word "Traditionalist" ?

    Many thanks

    Remi

  20. Opinion on Boost by Anonymous Coward · · Score: 0

    Why did nobody extend the STL sensibly in order to prevent the complete mess called 'boost' to arise ?
    Why the C++ community does not understand that difference between good abstraction (STL) and overengineering/ boilerplate / pointless genericity (BOOST) ?

    1. Re: Opinion on Boost by catf00d · · Score: 1

      Anyone can tell you Boost is a mixed bag. It was begun as an incubator for future std libraries, and it's succeeded: most of the new libraries in C++11 were Boost libraries first. Shared_ptr, chrono, random, regex... all good libraries. That's not to say all the Boost libraries should be in the standard, or are fit for that.

  21. Is Generic Programming Domain Specific? by igibbs.cse · · Score: 1

    Is there a domain that is better for generic programming than others? When Alexander talks about efficiency in "Elements of Programming", it seems that generic programming is specifically targeted for writing libraries. So, are there areas that benefit more from generic programming (like libraries) and areas that benefit less, such as user interfaces?

  22. goto considered harmful by yotam · · Score: 1

    What is your current view on Dijkstra classic claim:
        "go to statement considered harmful"
    in Communications of the ACM / March 1968

  23. Pedestrian day-to-day programming by Anonymous Coward · · Score: 0

    The mathematical/generic programming approach you present in "From Mathematics to Generic Programming" has clearly been very successful in the design of libraries like STL, and has been adopted by languages other than C++. However, most day-to-day programming is very different from the kinds of problems that STL solves, or that you discuss in your books. Most programmers spend most of their time solving one-off problems that are very specific to their application, and writing code that is only ever intended to be used in one specific context (i.e. not intended to be generic).

    As David Brooks said, "Einstein repeatedly argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer. Much of the complexity he must master is arbitrary complexity..."

    Is generic programming applicable to day-to-day lives of working programmers? Do you know of examples where these ideas have been applied to messy, irregular, real-world applications?

  24. Loss of Algorithmic Knowledge by Anonymous Coward · · Score: 0

    I watched some of your A9 lectures on YouTube, and discovered some amazing algorithmic ideas --- for example, the binary counter, the minmax algorithm, and quicksort implementation tricks/optimizations --- which I have not encountered in any algorithms books. Since the number of people who implement basic algorithms is rapidly dwindling these days, I am worried that basic algorithmic knowledge is being lost. Is there a resource where I can learn more about these techniques? I would love for you to write a series of articles (or give a series of lectures) about these topics (suggested title: "algorithmic gems").

  25. Complexity of generic code by Anonymous Coward · · Score: 0

    You have argued in the past that making code generic makes it simpler. In my experience, it is the reverse: reading, understanding, and debugging generic code seems to be harder than non-generic code. This is also consistent with mathematics. It is easier to teach someone arithmetic than to teach abstract algebra. And, you yourself say in your books and lectures that one should start with concrete code before making it generic.

    In what sense then is generic code simpler? Is complexity a disadvantage of generic programming?

  26. Hardware evolution by jonkalb · · Score: 1

    The STL is about three decades old. In that time, we've seen both OS and hardware evolution. What is the impact of these changes on how the STL should be used? How would the STL be different if it where implemented targeting modern environments?

  27. STL by Anonymous Coward · · Score: 0

    If you were to re-write STL in today's modern C++ or any feature that is proposed for C++ but not yet implemented. Which features do you think you would find most useful or be excited to have available to you that you didn't have when you first imagined STL in old C++.

  28. Standardisation of Concepts by ikoleverhate · · Score: 1

    Mr Stepanov, do you follow the ongoing efforts to standardise Concepts as a language feature in iso c++? If so, how do you think it's going? Would you do anything differently? To what extent do you think the standard library should provide Concepts? I recall learning about Concepts from the SGI STL doc many years ago and being very surprised to find that things like ForwardIterator weren't part of the iso spec.

  29. History of standardization of STL by alphabetsoup · · Score: 1

    STL was a pretty radical departure from the way classes and libraries were designed pre-STL. I am very keen to know a bit about the history of STL’s inclusion into the standard.

    When you originally proposed STL for adoption into the C ++ standard, how receptive / enthusiastic was the C++ committee towards STL? What design decisions / compromises did you have to make to get it accepted? How much resistance did you face?

    For example, you have noted that it took a major effort to convince the committee that vector must be contiguous. Was such instances common?

  30. Success of STL by alphabetsoup · · Score: 1

    STL has been wildly successful and has pretty much completely changed the way libraries are designed not just in C++ but also in in other languages. Most mainstream languages have added facilities to write generic code.

    When designing and proposing STL for inclusion into the standard, did you expect it to be this successful? Why do you think it has been this successful?

  31. Concepts in C++ by alphabetsoup · · Score: 1

    In you book "Elements of Programming", you spend a lot of time on concepts. The paper "A Concept Design for the STL", the basis of the latest concept design for C++, references your book extensively. You of course co-authored that paper. I am therefore quite keen to hear your views on C++ Concepts.

    Do you think that language support for concepts (or equivalent constructs like Haskell typeclasses) is important for writing generic code? How deeply are you involved in the effort to get concepts into the C++ standard?

  32. Deficiencies in C++ by alphabetsoup · · Score: 1

    As we all know, C++ is far from perfect. There are several features which you discuss in your books and papers, like concepts and UNDERLYING_TYPE, which C++ is currently missing but proposed for C++17 (e.g. destructive move). However there are things you have criticized before, like the memory allocation interface, which are still as they were 25 years back.

    What do you dislike the most about C++? What would you change or add to the language to make it better?

  33. Limitations of STL Design by alphabetsoup · · Score: 1

    The iterator based approach of STL works very elegantly for 1 dimensional data structures but fails to generalize cleanly for higher dimensional structures. For example, there is no easily defined way of iterating over a 2d array or a graph. Also, the notion of regular types, discussed in your book Elements of Programming, also fails to generalize for 2 or higher dimensional types, like complex numbers and matrices. They lack the total ordering property.

    Of course, you can artificially define an ordering, say force a row-by-row iteration over a 2D-Array or a breadth-first iterator over a tree or an artificial ordering on complex numbers, but such constructs feel artificial. Do you think this limitation is fundamental to the iterator based design approach?

  34. Inspiration for programmers by Anonymous Coward · · Score: 0

    In your "Spoils of the Egyptians" talk, you said "We have to develop our sense of beauty, and use it, to succeed in programming." I agree. I also agree that studying Mathematics is a good way to develop our sense of beauty. Conversely, learning how to program helped me write better proofs.

    Do you suggest any particular people or works outside of engineering and mathematics that are helpful for becoming better programmers? I am thinking of literature, philosophy, "soft" sciences, or humanities more than visual arts and music.

  35. Mathematics and Computer Programming by Anonymous Coward · · Score: 0

    Hello,

    It's always been interesting to me to see how many programmers do not come from math backgrounds, and yet we
    know that there's a correspondence between computer programs and certain kinds of construction proofs. This suggests
    that the foundations of logical thought don't need to come from traditional mathematics, but what would you say are the
    essential things that should be brought to the attention of such a programmer?

  36. C++ and allocations on the stack by Anonymous Coward · · Score: 0

    C(++) allocates local objects on the stack and dynamically allocated objects on the heap.

    However, Linux provides the alloca() function that allocates memory in the stack frame of the caller. This temporary space is automatically freed when the function that called alloca() returns to its caller.

    How could C++ take advantage of that? (other than custom allocators and such). Are any new language features needed?

    1. Re:C++ and allocations on the stack by Anonymous Coward · · Score: 0

      My take on it: Doesn't benefit us.

      In the uses I've seen of alloca, it is used for variable-length objects, typically in the form of a 0-sized array which you then deliberately access out-of-bounds.
      struct { char[0] bar; } foo;
      alloca(bytes_expected());
      read_to_buf(foo.bar);
      do_something_with(foo.bar[15]); // Or -15 depending on arch? Would in any case need to be calculated rather than hardcoded.
      This drops you down from the level of whatever task you're performing to pointer arithmetic. And into quite unsafe territory.

      This allows C code to accept arbitrary length strings without performing a malloc in every case.

      In C++ the standard string class typically has the "small string optimization".
      This means we accept arbitrary string sizes, but only allocate when the input grows beyond a certain size. (Below that, it's contained in the string object itself.)
      Code running in tight enough loops that the allocation overhead is significant, is typically using very small strings each iteration, so in c++ we usually get this for free.
      In the very rare case, we can use other mechanisms entirely to handle this.

      To also cover all other use cases: to use alloca requires careful management of the stack which makes it infeasible to encapsulate the gritty details of alloca usage in a class. (Can compilers, in C++, reorder local variables? This would be safe in "normal" code.) Theoretically a compiler could create an implicit "scoped_string" instead of std::string for the local variable case, unless it would (gasp) actually get used outside of the current function. Low reward/effort value.

      TL;DR: Alloca() was designed to solve a problem only C programmers have, at a cost only C programmers could fail to notice (because they're usually paying that cost anyway).

  37. Where Compilers Beat Mathematics by Anonymous Coward · · Score: 0

    Hi,

    so far I read parts of your book: "From Mathematics to Generic Programming"

    While it is an interesting read I find there is a lack of profiling.
    For example, the multiplication of int32 was fastest on my machine when using the naive approach and Egyptian multiplication was worse.
    After that the algorithm was constantly micro-optimised, yet the performance on my machine degraded and an initially beautiful algorithm appeared distorted.

    That is especially bad since this is basically the intro to an otherwise interesting book.

    Granted, you are talking about generic algorithms and I am talking about int32 in an introductory example. Applying this algorithm to other types might actually pay off.

    Baseline what do you think of adding also remarks (!) [1] for practical application in following editions?
    Like profiling algorithms before adopting a more complex one that has worse results in practice.

    Cheers!
    Matthias

    [1] I know that giving actual numbers would make the book outdated on its release.

  38. Eudlid's Elements by jonkalb · · Score: 1

    In your book you mention Euclid's Elements. It is the oldest continuously use textbook in history, but is it really relevant to a computer science education?

  39. segmented iterators by rnickb · · Score: 1

    The STL iterator approach as proven very successful for data structures like lists/vectors/tree/etc. Yet for data structures that have a segmented structure such as deque, hash tables, sub-matrices, B-trees, STL has a high abstraction cost for iterators, forcing you to make extra unnecessary checks when comparing two iterators. (see for example Matthew H. Austern's paper "Segmented Iterators and Hierarchical Algorithms": http://lafstern.org/matt/segme...) Do you believe STL should be extended with an additional iterator abstraction to handle such data structures (like Austern's proposed segmented iterators) or do you believe it's too difficult to handle such data structures in a optimal generic way?

  40. STL, ranges, and C++17 by rnickb · · Score: 1

    Eric Niebler recently proposed a major TS (https://github.com/ericniebler/range-v3) that aims to refactor STL to introduce ranges. It also breaks compatibility in minor ways (e.g. by allowing for two iterators specifying first and last positions to be of different types), so it will likely be introduced as a new additional library to eventually replace the existing STL, while being very close to compatible. Given that such a rewrite is open to making some changes that break compatibility, are there any other modifications you'd like to see? And what else would you like to see in a C++17 version of STL?