Чарльз Петзольд Windows 8 and WinRT
Aug. 8th, 2012 09:25 amЧарльз Петзольд, по книжке которого я знакомился с WinAPI дал интервью, про Win8, WinRT, etc.
http://community.devexpress.com/blogs/sarafaatz/archive/2012/08/07/connections-charles-petzold.aspx
А здесь короткое описание - что такое WinRT, C++, COM, NET и что из чего растет.
Если внимательно почитать, то видно что развитие идет циклически и после достаточно долгого и глубоко увлечения одними методами, инструментами и парадигмами происходит коррекция и развитие меняет направление, заходит на седующий виток.
Но уже с переосознанием ценности, возможностей и ограничений инструментов и технологий, которые еще недавно были фаворитами.
http://www.it-visions.de/lserver/artikeldetails.aspx?b=6241
Charles Petzold has been writing about Windows programming for 25 years. A “Windows Pioneer Award” winner, Petzold is author of the widely acclaimed Code: The Hidden Language of Computer Hardware and Software, Programming Windows Phone 7, and more than a dozen other books. His classic Programming Windows,
the sixth edition of which is currently in progress, is lauded as one of the best-known and widely used programming books of all time.
I had an opportunity to connect with him and learn what he’s learned while writing Programming Windows, 6th Edition, about the books he reads, and his desire for a gamelan ensemble or Vannevar Bush's Differential Analyzer in his home.
SF: As the author of the new book, Programming Windows, 6th Edition, you probably have more insight into Windows 8 and WinRT than anyone out there. What has surprised you, disturbed you, and pleased you the most about Windows 8 in general and WinRT specifically?
CP: I like the mix of continuity and innovation. For programmers who have worked with C# and XAML (or with HTML 5 and JavaScript), a lot of WinRT is familiar territory. But in particular I've been impressed by two aspects of WinRT: The first is that touch, mouse, and pen input have been consolidated into a uniform collection of events, so it's no longer necessary to add touch to an existing mouse application, or add mouse support to a program optimized for touch. You're working with all three forms of input at the same time, but you can also distinguish between them if you need to.
I've also been impressed by the extent to which asynchronous processing is an integral part of WinRT, and the ease with which we can do asynchronous processing in C#. In C++, it's not so easy, but then few things are easier in C++.
Most disturbing, I guess, is that WinRT is much more like Silverlight than WPF. We veterans miss several powerful features of WPF that simply never made it into Silverlight or WinRT, and perhaps never will. For WPF developers, this comes under the category of accepting the things we cannot change.
Most surprising is the extent to which C++ and native code seem to be an increasingly important part of the new landscape of application development. In particular, DirectX is a vital part of Windows 8 as well as Windows Phone 8. The debate between developer productivity with managed code vs. program efficiency with native code has been renewed, and I think that's a good thing. No one language or programming environment is the solution to every problem.
SF: That is great insight, Charles. So for all of the developers out there who are chomping at the bit to start writing Metro-style apps, what advice do you have for them?
CP: Start now. Download the Windows 8 Release Preview, install the development tools, and find a good book to guide you through. Get your fingers on the screen, and explore the motion and orientation sensors. Those are the frontiers.
SF: That’s really solid advice. You have been writing about Windows (among other things) for more than 25 years. What have you enjoyed writing about the most?
CP: It's always a challenge to immerse oneself in a new programming environment and struggle to learn in sufficient depth to be able to write a book. A lot of anguish and swearing goes on, but I enjoy the experience. Yet, I must confess that my greatest overall writing pleasure has involved two books that are rather different from the programming tutorials. These two books are -- pardon the extensive subtitles -- "Code: The Hidden Language of Computer Hardware and Software" and "The Annotated Turing: A Guided Tour through Alan Turing's Historic Paper on Computability and the Turing Machine." I have a few more ideas for books of this sort, and one of my goals over the next decade is to bring at least two of them into reality.
SF: That’s very cool. I’ll definitely watch your blog for those titles. In your software books, you include a lot of sample apps and tutorials. Which did you enjoy writing the most?
CP: Two years ago I took a two-day course on programming for Microsoft Surface -- the coffee-table-style computers now rebranded as PixelSense -- and on the second morning I wrote a program that conceptually features a spinning disk, and when you touch it and move your fingers around, you paint colors on the disk, but what you paint is also reflected in the four quadrants of the disk so it becomes an interesting design. It turns out that the touch processing and graphics are complex enough to pose a challenge for whatever platform I bring this to. The Windows Phone 7 version is in the marketplace under the name SpinPaint, but it's an XNA program rather than Silverlight, and the Windows 8 version makes use of DirectX.
SF: From books you write to books you read. What books are on your bookshelf (or on your eReader)?
CP: Writing a book is so consuming that I'm not getting an opportunity to read as much as I like. But I recently finished Kate Summerscale's "Mrs. Robinson's Disgrace," a fascinating dissection of mid-Victorian culture in the context of one of the first scandalous divorces to take place under England's Divorce Act of 1857. I'm making my way through Hilary Mantel's novel "Bring up the Bodies," the second in her trilogy about Henry VIII seen through the eyes of Thomas Cromwell. Hoping for my return back to the world of the reading are Stephen Carter's alternative history "The Impeachment of Abraham Lincoln" and Rebecca Stott's "Darwin's Ghosts," which traces evolutionary concepts back to Aristotle.
SF: Wow. All of those sound very interesting. What else might people not know about you?
CP: If I had the space for it, I would buy a loom and learn how to weave, and if I had even more space I would build a replica of Vannevar Bush's Differential Analyzer, and if I had even more space I would put together a gamelan ensemble, so maybe it's best that I'm confined to very small living quarters.
SF: LOL. It may be best, but I would love to see (and hear) all of those! One last question and then I’ll let you go. What is your favorite word?
CP: Eclectic. It's similar to electric but much more versatile.
SF: Love it! Always a pleasure Charles. Thank you!
Die Windows Runtime (WinRT) ist eine neue objektorientierte Programmierschnittstelle (API) auf Basis von COM in Windows 8. Sie kann sowohl für Metro-basierte "Windows Apps" als auch "klassische" .NET-Anwendungen verwendet werden. WinRT versteht sich als Ablösung für das Win32-API (es ist kein Aufsatz auf Win32 wie das .NET Framework).
Auf Basis von WinRT ist die Programmierung sowohl mit .NET-Sprachen C# oder Visual Basic, mit C und C++ als auch JavaScript möglich. Die Oberflächenbeschreibung erfolgt im Fall von Sprachen C#, Visual Basic, C und C++ ist XAML; im Fall von JavaScript ist es HTML.
WinRT umfasst ca. 1800 Klassen. WinRT deckt bislang nicht den ganzen Funktionsumfang des Win32-API ab. Aber WinRT bietet mehr Zugriff auf Ressourcen (insbes. Hardware) als das .NET Framework bisher. In .NET musste man bisher die objekorientierte Welt verlassen und mit P/Invoke arbeiten.
WinRT umfasst auch Funktionen, die es im .NET Framework schon gibt.
Metro-basierte Anwendungen können grundsätzlich nur WinRT verwenden.
Klassische Desktop-Anwendungen auf .NET-Basis können WinRT zusätzlich zum .NET Framework verwenden.
Hintergrundinfos: Nativer Code, basierend auf einer neuen Version von COM
WinRT ist in C++ als eine COM-Komponente implementiert und liegt komplett in nativem Code vor. COM ist das Softwarekomponentenmodell, das 2002 von .NET abgelöst werden sollte. Nun gibt es nach mehr als zehn Jahren Stillstand das COM-Softwarekomponentenmodell in einer neuen klassenbasierten Fassung – bisher war das Kernkonzept die Schnittstelle. Microsoft hat nun viele Konzepte aus .NET zurück nach COM portiert.
Die für C# und Visual Basic sowie JavaScript verfügbaren Klassen sind nur "Wrapper". Ein neues Typsystem sorgt dafür, dass die Typen in verschiedene Sprachen "projiziert" werden und damit dort verfügbar sind. Das darunter COM liegt, erkennt man auch an den HRESULT-Werten. Die WinRT verwendet das alte HRESULT-Konzept. Die Wrapper-Klassen bilden einige HRESULT-Werte auf Exception-Klassen ab und den Rest auf die generische COM-Exception.
WinRT-Klassen besitzen Metadaten genau wie .NET-Anwendungen. Das Metadatenformat heißt WinMD, entspricht aber dem .NET-Metadatenformat. Die Abfrage der Metadaten zur Laufzeit (Reflection) wird unterstützt. Ziel bei WinRT war ein geringer Overhead und maximale Leistung – sicherlich ein Tribut an die größere Menge C++-Entwickler, die Microsoft bisher nicht von Managed Code begeistern konnte. Auch das Rendering von XAML ist in der WinRT nun in nativem Code realisiert und hat damit das Potenzial, schneller zu sein als WPF und Silverlight.
Im Fall von in C# oder Visual Basic geschriebenen Metro Apps führt wie bisher die Common Language Runtime (CLR) den Managed Code aus. Es steht aber nur eine Teilmenge der .NET-Klassen zur Verfügung. Die Darstellung in WinRT erfolgt nicht via GDI, sondern mit DirectX. Eine Message Loop gibt es nicht mehr.
Metro Apps kennen nicht das Konzept einer gemeinsamen Bibliothek (Shared Library), das heißt, jede Metro App muss ihre DLLs selbst mitliefern. Nur die WinRT-DLLs sind geteilt.
WinRT wird von Microsoft als integraler Bestandteil des Betriebssystems betrachtet, nicht als ein zusätzliches Framework. Daher wird WinRT zusammen mit jedem Build von Windows kompiliert. Und es heißt auch, dass WinRT nicht für ältere Betriebssysteme als Add-on nachgeliefert werden soll – so ist der aktuelle Stand. Unternehmen, die Client-Anwendungen entwickeln, müssen also in Zukunft zwei Codebasen pflegen, wenn sie ihre Anwendungen sowohl für den klassischen Desktop als auch Windows 8 Metro anbieten wollen.
WinRT ist verfügbar für die Prozessorarchitekturen x86, x64 und ARM. In der Keynote am ersten Tag sah man auch, dass WinRT-Anwendungen mit nur "einer geänderten Codezeile" auf Windows Phone laufen können. Was das für Silverlight auf Windows Phone bedeutet, blieb allerdings offen.
http://community.devexpress.com/blogs/sarafaatz/archive/2012/08/07/connections-charles-petzold.aspx
А здесь короткое описание - что такое WinRT, C++, COM, NET и что из чего растет.
Если внимательно почитать, то видно что развитие идет циклически и после достаточно долгого и глубоко увлечения одними методами, инструментами и парадигмами происходит коррекция и развитие меняет направление, заходит на седующий виток.
Но уже с переосознанием ценности, возможностей и ограничений инструментов и технологий, которые еще недавно были фаворитами.
http://www.it-visions.de/lserver/artikeldetails.aspx?b=6241
Charles Petzold has been writing about Windows programming for 25 years. A “Windows Pioneer Award” winner, Petzold is author of the widely acclaimed Code: The Hidden Language of Computer Hardware and Software, Programming Windows Phone 7, and more than a dozen other books. His classic Programming Windows,
the sixth edition of which is currently in progress, is lauded as one of the best-known and widely used programming books of all time.
I had an opportunity to connect with him and learn what he’s learned while writing Programming Windows, 6th Edition, about the books he reads, and his desire for a gamelan ensemble or Vannevar Bush's Differential Analyzer in his home.
SF: As the author of the new book, Programming Windows, 6th Edition, you probably have more insight into Windows 8 and WinRT than anyone out there. What has surprised you, disturbed you, and pleased you the most about Windows 8 in general and WinRT specifically?
CP: I like the mix of continuity and innovation. For programmers who have worked with C# and XAML (or with HTML 5 and JavaScript), a lot of WinRT is familiar territory. But in particular I've been impressed by two aspects of WinRT: The first is that touch, mouse, and pen input have been consolidated into a uniform collection of events, so it's no longer necessary to add touch to an existing mouse application, or add mouse support to a program optimized for touch. You're working with all three forms of input at the same time, but you can also distinguish between them if you need to.
I've also been impressed by the extent to which asynchronous processing is an integral part of WinRT, and the ease with which we can do asynchronous processing in C#. In C++, it's not so easy, but then few things are easier in C++.
Most disturbing, I guess, is that WinRT is much more like Silverlight than WPF. We veterans miss several powerful features of WPF that simply never made it into Silverlight or WinRT, and perhaps never will. For WPF developers, this comes under the category of accepting the things we cannot change.
Most surprising is the extent to which C++ and native code seem to be an increasingly important part of the new landscape of application development. In particular, DirectX is a vital part of Windows 8 as well as Windows Phone 8. The debate between developer productivity with managed code vs. program efficiency with native code has been renewed, and I think that's a good thing. No one language or programming environment is the solution to every problem.
SF: That is great insight, Charles. So for all of the developers out there who are chomping at the bit to start writing Metro-style apps, what advice do you have for them?
CP: Start now. Download the Windows 8 Release Preview, install the development tools, and find a good book to guide you through. Get your fingers on the screen, and explore the motion and orientation sensors. Those are the frontiers.
SF: That’s really solid advice. You have been writing about Windows (among other things) for more than 25 years. What have you enjoyed writing about the most?
CP: It's always a challenge to immerse oneself in a new programming environment and struggle to learn in sufficient depth to be able to write a book. A lot of anguish and swearing goes on, but I enjoy the experience. Yet, I must confess that my greatest overall writing pleasure has involved two books that are rather different from the programming tutorials. These two books are -- pardon the extensive subtitles -- "Code: The Hidden Language of Computer Hardware and Software" and "The Annotated Turing: A Guided Tour through Alan Turing's Historic Paper on Computability and the Turing Machine." I have a few more ideas for books of this sort, and one of my goals over the next decade is to bring at least two of them into reality.
SF: That’s very cool. I’ll definitely watch your blog for those titles. In your software books, you include a lot of sample apps and tutorials. Which did you enjoy writing the most?
CP: Two years ago I took a two-day course on programming for Microsoft Surface -- the coffee-table-style computers now rebranded as PixelSense -- and on the second morning I wrote a program that conceptually features a spinning disk, and when you touch it and move your fingers around, you paint colors on the disk, but what you paint is also reflected in the four quadrants of the disk so it becomes an interesting design. It turns out that the touch processing and graphics are complex enough to pose a challenge for whatever platform I bring this to. The Windows Phone 7 version is in the marketplace under the name SpinPaint, but it's an XNA program rather than Silverlight, and the Windows 8 version makes use of DirectX.
SF: From books you write to books you read. What books are on your bookshelf (or on your eReader)?
CP: Writing a book is so consuming that I'm not getting an opportunity to read as much as I like. But I recently finished Kate Summerscale's "Mrs. Robinson's Disgrace," a fascinating dissection of mid-Victorian culture in the context of one of the first scandalous divorces to take place under England's Divorce Act of 1857. I'm making my way through Hilary Mantel's novel "Bring up the Bodies," the second in her trilogy about Henry VIII seen through the eyes of Thomas Cromwell. Hoping for my return back to the world of the reading are Stephen Carter's alternative history "The Impeachment of Abraham Lincoln" and Rebecca Stott's "Darwin's Ghosts," which traces evolutionary concepts back to Aristotle.
SF: Wow. All of those sound very interesting. What else might people not know about you?
CP: If I had the space for it, I would buy a loom and learn how to weave, and if I had even more space I would build a replica of Vannevar Bush's Differential Analyzer, and if I had even more space I would put together a gamelan ensemble, so maybe it's best that I'm confined to very small living quarters.
SF: LOL. It may be best, but I would love to see (and hear) all of those! One last question and then I’ll let you go. What is your favorite word?
CP: Eclectic. It's similar to electric but much more versatile.
SF: Love it! Always a pleasure Charles. Thank you!
Die Windows Runtime (WinRT) ist eine neue objektorientierte Programmierschnittstelle (API) auf Basis von COM in Windows 8. Sie kann sowohl für Metro-basierte "Windows Apps" als auch "klassische" .NET-Anwendungen verwendet werden. WinRT versteht sich als Ablösung für das Win32-API (es ist kein Aufsatz auf Win32 wie das .NET Framework).
Auf Basis von WinRT ist die Programmierung sowohl mit .NET-Sprachen C# oder Visual Basic, mit C und C++ als auch JavaScript möglich. Die Oberflächenbeschreibung erfolgt im Fall von Sprachen C#, Visual Basic, C und C++ ist XAML; im Fall von JavaScript ist es HTML.
WinRT umfasst ca. 1800 Klassen. WinRT deckt bislang nicht den ganzen Funktionsumfang des Win32-API ab. Aber WinRT bietet mehr Zugriff auf Ressourcen (insbes. Hardware) als das .NET Framework bisher. In .NET musste man bisher die objekorientierte Welt verlassen und mit P/Invoke arbeiten.
WinRT umfasst auch Funktionen, die es im .NET Framework schon gibt.
Metro-basierte Anwendungen können grundsätzlich nur WinRT verwenden.
Klassische Desktop-Anwendungen auf .NET-Basis können WinRT zusätzlich zum .NET Framework verwenden.
Hintergrundinfos: Nativer Code, basierend auf einer neuen Version von COM
WinRT ist in C++ als eine COM-Komponente implementiert und liegt komplett in nativem Code vor. COM ist das Softwarekomponentenmodell, das 2002 von .NET abgelöst werden sollte. Nun gibt es nach mehr als zehn Jahren Stillstand das COM-Softwarekomponentenmodell in einer neuen klassenbasierten Fassung – bisher war das Kernkonzept die Schnittstelle. Microsoft hat nun viele Konzepte aus .NET zurück nach COM portiert.
Die für C# und Visual Basic sowie JavaScript verfügbaren Klassen sind nur "Wrapper". Ein neues Typsystem sorgt dafür, dass die Typen in verschiedene Sprachen "projiziert" werden und damit dort verfügbar sind. Das darunter COM liegt, erkennt man auch an den HRESULT-Werten. Die WinRT verwendet das alte HRESULT-Konzept. Die Wrapper-Klassen bilden einige HRESULT-Werte auf Exception-Klassen ab und den Rest auf die generische COM-Exception.
WinRT-Klassen besitzen Metadaten genau wie .NET-Anwendungen. Das Metadatenformat heißt WinMD, entspricht aber dem .NET-Metadatenformat. Die Abfrage der Metadaten zur Laufzeit (Reflection) wird unterstützt. Ziel bei WinRT war ein geringer Overhead und maximale Leistung – sicherlich ein Tribut an die größere Menge C++-Entwickler, die Microsoft bisher nicht von Managed Code begeistern konnte. Auch das Rendering von XAML ist in der WinRT nun in nativem Code realisiert und hat damit das Potenzial, schneller zu sein als WPF und Silverlight.
Im Fall von in C# oder Visual Basic geschriebenen Metro Apps führt wie bisher die Common Language Runtime (CLR) den Managed Code aus. Es steht aber nur eine Teilmenge der .NET-Klassen zur Verfügung. Die Darstellung in WinRT erfolgt nicht via GDI, sondern mit DirectX. Eine Message Loop gibt es nicht mehr.
Metro Apps kennen nicht das Konzept einer gemeinsamen Bibliothek (Shared Library), das heißt, jede Metro App muss ihre DLLs selbst mitliefern. Nur die WinRT-DLLs sind geteilt.
WinRT wird von Microsoft als integraler Bestandteil des Betriebssystems betrachtet, nicht als ein zusätzliches Framework. Daher wird WinRT zusammen mit jedem Build von Windows kompiliert. Und es heißt auch, dass WinRT nicht für ältere Betriebssysteme als Add-on nachgeliefert werden soll – so ist der aktuelle Stand. Unternehmen, die Client-Anwendungen entwickeln, müssen also in Zukunft zwei Codebasen pflegen, wenn sie ihre Anwendungen sowohl für den klassischen Desktop als auch Windows 8 Metro anbieten wollen.
WinRT ist verfügbar für die Prozessorarchitekturen x86, x64 und ARM. In der Keynote am ersten Tag sah man auch, dass WinRT-Anwendungen mit nur "einer geänderten Codezeile" auf Windows Phone laufen können. Was das für Silverlight auf Windows Phone bedeutet, blieb allerdings offen.