📜 ⬆️ ⬇️

Interview with Scott Meyers in Yandex. About present and future C ++

Scott Meyers is one of the most well-known and recognized experts in C ++, the author of the Effective Use of C ++ series of books that almost every professional C ++ developer has read and that has had a noticeable impact on the entire ecosystem and the quality of language use.

Personally, I almost became a fan of him as a student when I read Scott’s articles underlying his books in the early 2000s (the books themselves at that time were not yet translated in Russia, and I don’t have money for English from Amazon did not have).

Therefore, when he came to Yandex some time ago to conduct training for our developers, I could not use this chance to talk to him. The conversation turned out about how he sees the future of C ++ and programming in general, how different are developers in different countries and in different industries, and about him.
')




Original for those who prefer to read English
If you had to choose?

I think that for most programmers, it’s a daily basis, it’s lambda expressions. Those are the things that are the most visible to people.

I think that it was, in fact, more support for concurrency, which did not exist at all in C ++ 98. This is why it’s most importantly that it is the most common difference. I think it’s a good idea.

Even though the concurrency was implemented in libraries before?

It wasn’t the case that it was going to work. For example, there were optimizations compilers programs. And so now you can’t have a compiler. That makes it possible.

The same question, but about the most controversial changes. Is there something that can have a negative effect?

A couple of things come to mind. I think these are reasonable ideas. Then the question becomes - they were executed? One of them is usually the initialisation. It was a syntax for initializing everything. There are no ambiguities in certain cases. So I think there has been some controversy.

This is a great idea. It simply says, “I’m trying to get it.” It’s not a problem. This is a pretty reasonable chance that you can replace it.

So you mentioned the C ++ Standards Committee. What do you think about it? Does it do a good job? Or is it too slow or conservative in some respect?

I’m going to clarify this. The material is extremely technically demanding. It is easy to work. And even the simplest things need an enormous amount of effort.

Having said that, she thinks it shows. The girl wants to go. It can be a relatively impressive standard library.

So I think that the committee overall does a reasonable job. It is a little bit different. So that's my feeling about the Committee.

What do you think about it?

I think that it’s a committee of all parties. It makes it possible for him to be honest. It can be a clear vision. I cant play that role in C ++.

It is a very small cross-platform solution. Lots of compiler vendors. There is no need to say, “Say,” And also, just a range of applications. Especially when it comes to some systems.

It was a little bit of a c ++.

If you had a chance to go back to 95? Were there any wrong decisions in the C ++ history? What would you change?

I don't have specific things. It is not terribly consistent. This is something that is important to me, because And it makes my job more complicated.

It would be a little bit more than a lot of things to do.

It is a problem. So it is a significant success. Clearly, it’s a good job of getting a lot of programmers.

Is there a chance to have some backward compatibility? Something similar to Python 3 or Perl 6, for example.

This is a rule of thumb. It can be a tremendous backward compatibility. So there are some lines of it, it was written 20 or 25 years ago. It would be a great deal to decide to preserve peoples' investment. So I don't ever expect that to happen.

C ++ is sometimes criticized, Standard Library, Spartan, Standard Library. It doesn’t Do you think this is the right approach?

I think everybody agrees. Once you’ve been a woman, you can’t make it. There are some really nice libraries that have been built.

There aren't as many as we like. One of the reasons is, Java or C #, basically, there’s no corporate sponsor or crossplatform language. You’re available for everybody. But they are just kind of spread around.

It is a consorted effort. 1) Get the library and the standardization. You can find them. There is a definite effort being expended to make that happen. But there are few features than we would prefer.

Actually, two years ago, the creator of the original standard library. It’s not always the case. Do you think that this should be the case?

I believe that the standard library should be larger. I really think it should be some functionality. For example, it's 2014. There is no concept of a standard library of putting anything on a screen anywhere. There is no concept of graphics. That's silly. There is no concept of the Internet. There is no concept of the URL. There is no concept of the URI. For that matter, there is no concept of a file system. Would really be helpful. And, incidentally, there are also ways where the standardization can be actively working to address those particular issues. But it’s a little bit different.

Many people are asking for some standard repository. What do you think about this? The C ++ community can make it possible?

It would certainly be convenient. If you’re going to take it, you’re not going to take it. This has been a real challenge. It is a good idea to have a license. them and things like that. So I think that it’s possible, that it’s possible to see it.

How far do you think this future is from now? A few years?

I'd say probably ... I think, for the next 2-3 years. But we, sort of, have to see. Lots of different areas. This is really part of the Standardization Committee. It would be a matter of course. If you’re looking for information on a standard C ++ This is a project that has been working on. So I'm optimistic.

How do you think about it? C ++ is terrible, it’s actually, but it’s still possible. And I've heard many people from Google saying the same thing. And still they are using C ++. So how can we choose between, IDK, C ++ and Java. Do you think that?

Well, let me answer the last question first. It will be interesting, because it will be interesting for everyone. It is not the case that everybody is using them. I would like to use managed languages. I think that it is an extremely important language for production use. This is a simple way to get your car out. If that is what is the most important to you. I think that these days the primary competitors are C and C ++. Those are pretty much your choices. And C ++ is just a lot more expressive language. I have to say that I'm not a C programmer. I've never really been a C programmer. But I can think about it. And, obviously, there is a lot more? to it than that. In terms of the choice of engineering decision. You have to go to your account. Trying to optimize for a lot of things simultaneously. C ++ and help engineers use it better. It is not a problem.

What do you think is rarely used on mobile devices? All these new things use managed languages. Java for Android, Objective C and Swift for iOS. What does you think?

I don't follow the mobile market that closely. OK, everything will be programmed only in Java. And they said, well, program in C ++. Objective C. And then, OK, there is a backdoor, you can use C ++. So I think there is a demand for those languages. I think it is actually increased. Because developers are insisting on that. I think it’s an awful lot of mobile stuff. If you’re thinking about your mobile phone, you’ll have to go. If you are trying to get the maximum possible amount, it’s possible. So, I think, it's probably not going to mobile devices. Can not be running on mobile devices.


What are the two or three most important changes in C ++ 11/14?

If we talk about what most programmers encounter on a daily basis, then this is auto for declaring variables, and also probably lambda expressions. These are the two most notable changes.

Personally, I consider the most fundamental improvement in support for concurrency, which was not at all in C ++. This feature is not so striking programmers, except that the creators of compilers. But if we talk about the impact on people in general, then it is very likely that this feature will have the maximum impact. It is obvious that the semantics of the transfer is also extremely important, but from this point of view, parallelism seems a little more significant.

And what two changes were the most controversial or harmful?

A couple of things come to mind. Both are based on ideas that I think are quite reasonable. But then the question arises, were they used correctly? The first is what is commonly called universal initialization. Her idea was that we would have a single syntax for initializing everything in a row. It was not possible to achieve this, since in some cases there was uncertainty, there were situations in which list initialization cannot be used, another form should be used. That is, it seems there were some disagreements as to whether this feature should have been implemented this way.

Async and futures come to mind. Actually, this is a great idea. Just say that you want to run something asynchronously, and you don’t need to think about it. But in terms of the futures behavior specifications coming out of async, a lot of interesting things have been done. There was a lot of controversy inside the committee about whether to correct it or replace it with something. It seems to me that there is every chance that, starting with C ++ 17, new functions will be introduced to replace this.

Is the standardization committee doing its job quite effectively?

The first thing I would like to say about the Committee on Standardization (and I am not a member of it, this should be indicated immediately), they face a very difficult task. The material requires extremely deep technical knowledge. I have tremendous respect for those in this committee. The work that they do is very difficult, even the little things require great effort.

On the other hand, it sometimes becomes obvious that a committee is developing a language, rather than one person or a small group with a clear idea of ​​which direction the language should be developed. And it is really noticeable. For example, there are three ways to determine alignment, while the standard library is very scarce.
In general, the committee, in my opinion, copes with its work. I, of course, would like them to do some things differently. And they probably would like me to somehow join the committee, take part in the work. This is my attitude to the committee.

Perhaps it would be better if there was one person who is responsible for key decisions?

In my opinion, a committee is quite a reasonable way to bring several parties together. Frankly, I'm not sure that Björn would like to be the one who makes all the decisions. The advantage of such a person is that he has a clear vision that can be implemented. In C ++, no one took on this role, and I don’t know a person who could do it.

There is a slight difference compared to many other languages: since C ++ runs on a huge number of platforms, you have to deal with a huge number of operating systems, with many manufacturers of compilers. There are not too many languages ​​for which there are four main compilers working on different platforms. Do not forget about a wide range of applications. Especially if you start to think about what impact C ++ has had on embedded systems. There is a really important language there, and in many cases, the views of the world from the industry are quite different from the usual ones.
In general, it would be nice if, as I said, one person had a clear vision that he could broadcast. But this is hardly possible for C ++.

Is there any chance that in some version of C ++ there will be no backward compatibility, as was the case with some other languages?

I think the likelihood that a decision will be made that breaks backward compatibility is almost zero. It seems to me that one of the great strengths of C ++ is its excellent backward compatibility. Billions of lines of code were written, some of which appeared 20-25 years ago. The decision not to save the one introduced by others would be too difficult for the community. So I do not believe that this will ever happen.

C ++ is often criticized for being too short and abstract, almost spartan standard library. There is no such diversity, as in some modern languages. Do you think this approach is correct?

I’m sure everyone will agree that the standard library is too small and needs to be expanded. Apparently, this happened historically, due to the fact that people were too concentrated on the language. They believed that as soon as they could create a suitable language, it would be possible to create excellent libraries. And we have been waiting for these libraries for 20 years. In fact, there are such libraries, including very good ones. Just not as many as we would like. One of the reasons for such a strong difference between C ++ and, for example, Java or C #, is the absence of a corporate sponsor behind the language. The point is cross-platform. All that we have is volunteers who create libraries and share them with others. A lot of people have been engaged in this, but all of this is just a little dissipated.
The Standardization Committee has now become much more closely eyeing this. Now, it seems to me, different people are making concerted efforts, trying to 1) develop more libraries; 2) to assemble existing in a scattered form libraries (such as Boost, libraries of Microsoft, Facebook, Adobe) under a single license that suits everyone in one place where everyone could find them. The implementation of these projects is spent more and more effort. But there is no doubt that the standard library is too small and offers far fewer functions than we would like.

The authors of STL believed that the standard library should be small and atomic. This is one of the reasons that there are not some basic things for our time in it. What do you think about it?

I am sure that the standard library should be larger, that it should provide basic functionality. In the yard in 2014, and in the standard library there is no concept of displaying something on the screen. There is no concept of graphics - it's just ridiculous. There is no concept of the Internet, there is no concept of URL, URI. For this reason, there is basically no file system concept. It seems to me that a standard library would be very useful in this role. By the way, there are a couple of places where standardization could actively work to eliminate precisely these problems. I mean, there is a common need that many developers will face. It will just take a long time until all of this comes to a standard form and everyone will understand how it works.

Does C ++ need a single repository, and will it ever appear?

It will definitely be convenient. I do not know if this will ever happen, in what form it will be implemented. But this is quite consistent with the idea of ​​getting closer to people who already have ready libraries. Then we can say: OK, great, now we know where all the libraries are located. And if we can unite them under some kind of license supported by everyone, we can put them in one place, where everyone can see them, search for them, etc. So, in my opinion, the foundation for this is already being laid, but it will happen is it? Wait and see.

There are many people who have to use C ++ despite the fact that they do not like it. What do you think, by what principles should the language be chosen for large projects?

Perhaps I will answer the last question first. It's funny, because ten years ago everyone said so: here it will be a dozen years and everything will switch to controlled languages. And they are really very important, but not everyone uses them. It seems to me that C ++ will still remain an extremely important language in production. Just because the main goal here is to get the maximum performance from the machine. If this is important to you, then C and C ++ are still the main competitors. And C ++ is just a slightly more expressive language. It should be noted that I am not a C-developer and I have never really been one. But if I were one, then just mentioning destructors would be enough for me to think about switching to C ++. Just for the sake of being able to compile and get destructors. Of course, this is only a small fraction.

Returning to your question about choosing between languages: for me, this decision should be made by managers or senior engineers. You need to take into account what goals you set, what is the purpose of the software, what employees are at your disposal, what infrastructure is already built. And all these things need to try to optimize at the same time. I do not give any advice on this matter, my job is to understand C ++ and help developers use it more efficiently. Telling people whether they should use C ++ is not part of my task.

Is it bad that C ++ is rarely used on mobile devices? All of them still work in managed languages: Java on Android, Objective-C, and Swift on iOS. Is it time to more actively use C ++ in this area?

I am not very closely following the mobile market. As far as I understand, when Android appeared, everyone was announced: OK, now everyone should write in Java. And then they said: well, now there is a backdoor, thanks to which you can write in C ++. And the same with Objective-C. And then the backdoor again, through which you can use C ++. So, it seems to me, the ability to use native languages ​​is the need of developers writing for mobile platforms. And if you look from this point of view, the number of programs in C ++ for mobile platforms is not so small.

Developers insist on it. In addition, it seems to me, a huge part of the mobile code, in particular the backbone of the frontend, now works in the clouds. If we talk about mobile services, you need to take into account the fact that they spin on their servers, serving these mobile devices. And C ++ positions are definitely very strong on server farms, where they are trying to maximize profits from existing servers. So C ++ is likely to continue to be used in servers, and not in mobile devices. But there is no serious reason why it could not be used there.

Today you are one of the most famous C ++ experts. How did you start programming in this language?

In a sense, the choice was made without me. I started programming a long time ago, in 1972. My first language was Basic, in 1972 it was fairly common. But in 1985 I entered graduate school to get a PhD in computer science. The responsibilities of the graduate student included participation in some courses as an assistant teacher. Naturally, I was an assistant on a software development course. The professor who led the course said that he wanted to use some normal programming language. And he chose C ++, and in a couple of years I had to learn it. So I didn’t choose C ++, I just worked on a course where C ++ was the main language. That's how I started programming on it.

But you still prefer to connect your life with this language.

Honestly, it was an accident. I first learned C ++, and then I received an offer from a company that needed a C ++ course to train corporate clients. It was an interesting offer. I was a graduate student, there was a lot of work, and not much money. And they just said: let's write down everything that you already know, and we will pay you a lot of money for it. I replied that it sounds very attractive. So I became involved in C ++. Then I started to teach classes, wrote my first book, Effective C ++, which turned out to be quite popular. It's funny: when my wife asked the year in 1991 whether I would be doing this for a long time, I replied that this is a programming language, they usually live not that long, well, a maximum of five years. 25 years have passed, and we are still engaged in this. Such is the accident.

How did you move from articles to books? Is there a difference between creating articles and creating a book?

Several differences. First, by nature, the book covers a more extensive material, and secondly, you need to have a more general vision of the problem that you are going to solve. Finally, you need more space in which you will act. On the other hand, if you have a modest intention, then you don’t need to write a book, article is enough. So it all depends on how much you want to say. In addition, when you write an article in a journal, you only need to briefly hold the reader's attention. There are different techniques for this: you can provoke the reader, make him want to argue. It’s as if you’ve talked to someone standing next to you in line at a supermarket. This is a short conversation, and here you have a very small set of techniques. The book implies a longer contact with the reader. I would liken it to a conversation with a neighbor on a plane. You would hardly want to sit next to someone who contradicts you, argues with you and provokes during the six-hour flight. I even had to rewrite my second book - I felt that it was too much like a magazine article. After reading fifty pages of this, you start going crazy, hating the one who wrote all this. So exactly two things come to my mind: a greater reach and tone of the story.

Is there a difference between audiences in different cities? What types of audiences have you met?

Cultural differences between different countries are noticeable. Somewhere absolutely not afraid to argue with the speaker, ask questions. I met this in the US, England, Germany. There, people are not shy to say: wait, there is some kind of mistake. And you have to argue, justify. In other countries, people try not to create problems, they don’t want to offend you. By the way, in my experience, it is also possible to break through this if you try to actively involve people. This is especially easy if you spend more than two or three days with them - you get used to it. At my performances, students often come of their own accord. When they manage to reach out, it turns out that they are very clever and have interesting thoughts. So I do not see any special differences between developers in how they think, perceive the material, ask questions. I am very pleased that, wherever I come, I have to communicate with very smart people who work with really interesting tasks. Trying to keep up with them is for me both a challenge and a pleasure.

Do you write the code yourself now?

No, not very much. I decided many years ago that I was not a developer. I once developed software, wrote a lot of code when I was in graduate school. I used to be ashamed of it: telling everyone about programming, although I myself no longer practice. But this is not my job. It seems to me that the task of developers is to produce a product. To do this, you need to master the tools, the API, and eventually do something productive. They are too busy to keep track of everything that happens in the world of development and C ++. But my task is to monitor everything that happens, and then turn it into articles, books, speeches, so that developers can take it all in a relatively short time. So I’m no longer a developer, I don’t spend a lot of time programming, but I’ve stopped being shy. I decided that my work also makes perfect sense.

Source: https://habr.com/ru/post/241601/


All Articles