Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Write Portable Code: An Introduction to Developing Software for Multiple Platforms 1st Edition
Portable software development is writing software that runs on a broad range of computer systems instead of just one (e.g., Windows). Programmers often pick up the idioms, tricks and methodologies for developing cross-platform software through sheer trial and error, as they encounter the same mistakes and patterns of code over time. If you're an intermediate-to advanced-level programmer who'd rather cut to the chase, Write Portable Code contains the lessons, patterns and knowledge you'll need for developing cross-platform software.
Write Portable Code explains how to:
- avoid common portability mistakes when starting out a new project, thereby saving time when a port must occur
- re-factor existing, non-portable code so that it can be easily transplanted to new platforms
- find bugs masked by platform specific behaviors
Programmers who avoid becoming married to a specific development environment or target platform greatly expand the target market for their software products. Whether you design cross-platform software from the ground up or have to move large amounts of code from one platform to another, the information contained in Write Portable Code will help you achieve your goals and grow as a programmer.
TOC
Preface
IntroductionChapter 1: Preparing for PortabilityChapter 2: ANSI C/C++Chapter 3: Techniques for PortabilityChapter 4: Editing and Source ControlChapter 5: Processor DifferencesChapter 6: Floating PointChapter 7: PreprocessorChapter 8: Compiler QuirksChapter 9: User InteractionChapter 10: NetworkingChapter 11: Operating SystemsChapter 12: Dynamic LibrariesChapter 13: Security and PermissionsChapter 14: File SystemsChapter 15: Scalability and PortabilityChapter 16: Portability and DataChapter 17: Internationalization and LocalizationChapter 18: Scripting LanguagesChapter 19: Cross-platform Libraries and Toolkits
Appendix A: POSHAppendix B: The Simple Audio LibraryAppendix C: The Rules for PortabilityReferences
- ISBN-101593270569
- ISBN-13978-1593270568
- Edition1st
- PublisherNo Starch Press
- Publication dateJuly 15, 2005
- LanguageEnglish
- Dimensions7 x 0.81 x 9.25 inches
- Print length272 pages
Products related to this item
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on Amazon-
Top reviews
Top reviews from the United States
There was a problem filtering reviews right now. Please try again later.
This book is really focused on writing software that will run on essentially any platform that has a C compiler, which today is almost all processors. If you need to write software that will run on embedded 16 bit processors as well as the latest 64 bit ones, then you should read this book. However, there are large classes of software that have a more limited notion of portability (such as running on most 32 bit Unix or Windows platforms, or any platform that g++ can target) where Standard C++ or Java are the way to go. Unfortunately the book does not adequately address the tradeoffs, design, and implementation decisions one should make in these cases. In particular, I am puzzled by the total lack of Java solutions.
Since the book emphasizes C programming, there is minimal content on GUI programming, Web programming, database programming, and similar areas where C programming is rarely used anymore.
But if you are new to C/C++ programming or a student, then this book is likely a good read. The majority of the book builds awareness of portability issues, programming in the large, and common tools for professional programming (in the context of C/C++).
In 2011, I find that most of my C an C++ compatibility issues across operating systems are largely resolved by using STL and including <stdint.h>. The latter was not standard in 2005 (when the book was published) as it is today. As such, the book spends time explaining issues that are easily resolved by relying on these include files and libraries. There is a framework library implemented in the book called "Posh" (Portable Open Source Harness) that repeats much of <stdint.h> along with some functions that handle endian-ness and floating point variations between processors. Ironically, the book fails to mention Boost, which is a popular starting point for portable C++ development.
The harder C/C++ compatibility issues aren't easily resolved with header file macros. The real challenges of portable coding come from the fact that graphics, threading, I/O, networking, and APIs for making system calls vary widely between different flavors of Unix, Linux, and Windows. To which the book makes an effort to raise attention to, but very little effort on actually solving. The chapter on networking is 6 pages and doesn't go beyond declaring #defines for the subtle differences between Winsock and Unix sockets. Good luck trying to reconcile ePoll and IOCP, or the difference socket ioctl calls between platforms. The book rarely goes deep on any specific area of programming.
No book could cover every possible detail of every possible software port. Instead, the author focuses on the right attitude towards writing portable code. He demonstrates by example in each chapter, with C and C++ code you can download from his web page. Although the author focuses on C and C++ for the purpose of this text, the principles apply to any language, even supposedly portable languages like Perl.
It's not an expensive book for what you get. Even the most experienced programmer should find plenty to use here. The author's prose is easy and fun to read, and I laughed out loud more than once at some of his examples.
I recommend this book for all programmer levels.
8 years old, but still a good read.
My only complaint is that it doesn't get into deep details about moving stuff like sockets from Linux to Windows, but if Mr. Hook did this I'm sure the book would be 2000 pages long.
I'm surprised no one has written a book on this topic yet, but I'm glad this one is available now.
Top reviews from other countries
Im Vorwort wird noch betont, dass es sich an Programmierer aller Sprachen wendet, dennoch liegt der Fokus eindeutig auf maschinen-nahen Sprachen wie C und C++. Das sollte aber auch nicht verwundern, schließlich kann man hier im Bezug auf Portabilität am meisten falsch machen.
Etwa die Hälfte des Buches wird damit für z.B. Java-Programmierer komplett uninteressant - was aber nichts daran ändert, dass die andere Hälfte viel wissenswertes enthält, das man wohl in kaum einem anderen Buch findet.
Meiner Meinung nach ein Buch für jeden Programmierer, der bessere Software schreiben möchte und/oder langfristig erfolgreich sein möchte. Denn zum einen ist Software, die man nach den Richtlinien dieses Buches schreibt, nicht nur portabler, sondern auch Fehlerfreier und besser Wartbar. Zum anderen haben Viele Programme einen Lebenszyklus von mehr als zehn Jahren, und in einer Dekade ändern sich Plattformen stark - und fast jede Software wird früher oder später auf eine andere Plattform umziehen müssen. Der Autor begründet überzeugend, warum man sich darauf in jedem Fall so früh wie Möglich vorbereiten sollte.
Was die Menge der angesprochenen Problemfelder angeht, so macht das Buch einen sehr vollständigen Eindruck - und es gibt mehr Problemfelder, als man sich erträumen mag. Bei den Lösungen hapert es manchmal ein wenig, aber ein Problem zu identifizieren ist ja bekanntlich der schwerste Teil der Lösung.
Wer nun aber hofft, etwas über Bibliotheken und Frameworks zu erfahren, die Plattformunabhängigkeit erleichtern, wird herbe enttäuscht: Das Kapitel umdasst nichtmal zweieinhalb Seiten. Hier hätte man sicher mehr draus machen können, vielleicht sogar ein ganzes Buch für sich.
Wer sich in der Theorie schon ein wenig mit Plattformunabhängigkeit befasst hat, wird auch nichts bahnbrechend Neues erfahren. Als solide Zusammenfassung dessen, was man sowieso schon mal irgendwo gehört hatte und wahrscheinlich auch schon wieder vergessen hatte, ist das Buch aber bereits sein Geld wert.
Und wer sich bisher noch keine Gedanken über Plattformunabhängigkeit gemacht hat, sollte vielleicht jetzt damit anfangen. Am besten mit diesem Buch.
