Entries for tag "books", ordered from most recent. Entry count: 6.
# Book Review: C++ Lambda Story
Courtesy its author Bartłomiej Filipek, I was given an opportunity to read a new book “C++ Lambda Story”. Here is my review.
A book with 149 pages would be too short to teach entire C++, even in its basics, but this one is about a specific topic, just one feature of the language – lambda expressions. For this, it may seem like even too many, depending on how deeply the author goes into the details. To find out, I read the book over 3 evenings.
The book starts from the very beginning – the description of the problem in C++98/03, where lambdas were not available in the language, so we had to write functors - structs or classes with overloaded
operator(). Then he moves on to describing lambdas as introduced in C++11, their syntax and all the features. Every feature described is accompanied by a short and clear example. These examples also have links to the same code available in online compilers like Wandbox, Compiler Explorer, or Coliru.
In the next chapters, the author describes what has been added to lambdas in new language revisions – C++14, C++17, C++20, and how other new features introduced to the language interact with lambdas – e.g.
consteval and concepts from C++20.
Not only features of lambda expressions are described but also some quirks that every programmer should know. What if a lambda outlives the scope where it was created? What may happen when it is called on multiple threads in parallel? The book answers all these questions, illustrating each with a short, yet complete example.
Sometimes the author describes tricks that may seem too sophisticated. It turns out you can make a recursive call of your lambda, despite not directly supported, by defining a helper generic lambda inside your lambda. You can also derive your class from the implicit class defined by a lambda, or many of them, to have your
operator() overloaded for different parameter types.
Your tolerance to such tricks depends on whether you are a proponent of “modern C++” and using all its features, or you prefer simple code, more like “C with classes”. Nonetheless, lambda expressions by themselves are a great language feature, useful in many cases. The book mentions some of these cases, as it ends with a chapter “Top Five Advantages of C++ Lambda Expressions”.
Overall, I like the book a lot. It describes this specific topic of lambda expressions in C++ comprehensively, but still in a concise and clear way. I recommend it to every C++ programmer. Because it is not very long, you shouldn’t hesitate with reading it like it was a new project you need to find time for. You should rather treat it like an additional, valuable learning resource, as if you read several blog articles or watched some YouTube videos about a topic of your interest.
You can buy the book on Leanpub. I also recommend visiting authors blog: C++ Stories (new blog converted from bfilipek.com). See also my review of his previous book: “C++17 in Detail”. There is a discount for “C++ Lambda Story” ($5.99 instead of $8.99) here, as well as for both books ($19.99 instead of $23.99) here - valid until the end of February 2021.
# Book review: C++17 in Detail
Courtesy its author Bartłomiej Filipek, I was given an opportunity to read a new book "C++17 in Detail". Here is my review:
When I am about to read or decide whether to buy a book, I first look at two things. These are not the looks of the cover or the description on the back. Instead, I check the table of contents and the number of pages. It gives me a good overview of the topics covered and the estimation of chances they are sufficiently covered. "C++17 in Detail" with its 361 pages looks good as for a book describing what's new in C++17 standard, considering the additions to the standard are not as extensive as they were in C++11. The author is undoubtedly an expert in this field, as seen from entries on his Bartek's coding blog.
Author claims to describe all the significant additions to the language. However, this is not a dull, difficult to read documentation of the new language elements, like you can find on cppreference.com. Instead, the book describes each of them by giving some background and rationale, and showing real-life examples. It makes them easy to understand and to appreciate their usefulness. Each addition to the standard is also accompanied with a reference to the official documents by C++ standard committee and a table showing which versions of the most popular C++ compilers (GCC, Clang, Microsoft Visual C++) support it. Spoiler: They already support almost all of them :)
The book doesn't teach everything from scratch. That would be impossible in that number of pages, considering how big and complex C++ is. It assumes the reader already knows the language quite well, including some features from C++11 like
unique_ptr or r-value reference + move semantics. It explains however few topics needed for the book in more details, like the concept of "reduce" and "scan" parallel algorithms, which C++17 adds to the standard library.
The contents of the book is grouped into 3 parts. Part 1 describes additions to the C++ language itself, including init statement for
if(int i = Calculate(); i > 0) ...), additions to templates like
if constexpr, and attributes like
[[maybe_unused]]. Part 2 describes what has been added to its standard library, including
filesystem. Finally, part 3 shows more extensive code examples that combine multiple new C++ features to refactor existing code into more clean and more efficient one. The author also mentions what parts of the language have been deprecated or removed in the new standard (like
To summarize, I recommend this book to any C++ developer. It's a good one, and it lets you stay up-to-date with the language standard. You will learn all new features of the language and its standard library from it in a more pleasing way than by reading documents from the C++ committee. Even if you won't be able to use these new features in your current project because your old compiler not upgraded for many years or the coding standard imposed by your team lead doesn't let you, I think it's worth learning those things. Who knows if you won't be asked about them on your next job interview?
You can buy printed version of the book on Amazon.com and electronic version on Leanpub. Bartek, the author of the book, also agreed to give all of the readers of my blog a nice discount - 30%. It's valid till the end of October, and to use it just visit this link.
# DirectX 11.1 Game Programming - Contest Winners
Congratulations to lightning, WhiteLightning and Francis.C for winning digital copies of "DirectX 11.1 Game Programming", the book I had recently reviewed.
# Book Review: DirectX 11.1 Game Programming
"DirectX 11.1 Game Programming" is a new book published by Packt Publishing, written by Pooya Eimandar. It introduces new features of DirectX 11.1 and some other technologies available for game developers when writing Metro-style apps for Windows 8. The book uses C++/CX - a new language based on C++, with the syntax somewhat similar to C++/CLI (the language is extended by managed pointer operator ^). But while C++/CLI is a .NET language (like C#), C++/CX is compiled to native code and the ^ pointer is just a convenient syntax for reference-counting smart pointer to a COM object. Math is done with DirectXMath library (the successor of XNA Math).
Each of the chapters describes several loosely coupled topics. Their flattened list looks like this:
I have mixed feelings about this book. Contrary to what title suggests and what the author claims inside ("By the end of this chapter, we are going to have a multithreaded game engine"), you obviously cannot learn game programming by reading just 146 pages. Especially as the book covers so many different topics. It looks like the author wanted to include everything what's fresh and sexy in Microsoft Windows 8 API-s. As a result, each example is kind of "Hello World" - the simplest possible application of the described technology.
But at the same time, the book is also not teaching 3D games programming from the start. It explains some selected basic concepts in more details (e.g. describes what vertex shader does, shows how rotation matrices look like, how to use constant, vertex and index buffer or shows a diagram of the graphics pipeline - 3 times actually :) but generally you should already know C++ and preferably DirectX 10/11 to make use of the knowledge from this book. It is more like an overview of "What's New" in Windows 8, DirectX 11-11.1 and new Visual Studio.
I think the biggest value of this book is the attached source code. Each chapter is accompanied by a complete C++/CX project that shows an application of the described technology and the text in the book is an overview of this code. So if you already know some game programming in C++ and DirectX 10/11, this book can be a good tutorial which will help you to start using latest Microsoft technologies and develop Windows 8 Metro-style games. Preface says "This book will help you easily create your own framework and build your first game for Metro Style all by yourself in order to publish it on the Windows Store." and that is true.
But whether this is worth doing, that's another question. Surely you can use DX 11 on 9- or 10-compatible hardware, using Feature Level, but you cannot use most of what this book describes below Windows 8, and many of these things also without buying Visual Studio Professional or higher. According to Steam Hardware & Software Survey: Auguest 2013, while 64.78% of gamers already have DirectX 11 capable system and GPU, only 15.41% of them have Windows 8 installed (and it's already a year since its release).
Now it's time for a contest. Packt has proposed to offer 3 digital copies of the book. All you need to do is head on over to the book page, look through the product description of the book and then drop a line via the comments below this post to let us know what interests you the most about this book. 3 best comments win!!! Deadline: The contest will close in 1 weeks time. Winners will be contacted by email, so be sure to use your real email address when you comment.
# HLSL Development Cookbook - Contest Winners
Congratulations to Tommy, czoper and Mark for winning digital copies of HLSL Development Cookbook, the book I had just reviewed.
# Book Review: HLSL Development Cookbook
I've been given a chance to read a book HLSL Development Cookbook published recently by Packt Publishing. Below you can find my review. Packt has proposed to offer 3 digital copies of the book. Keep reading to find out how you can win a copy.
The book has 224 pages. Its author - Doron Feinstein - works as Senior Graphics Programmer in Rockstar Games. The book is about implementing various rendering techniques in HLSL using DirectX 11. It uses new features of this API, e.g. geometry shaders, compute shaders, UAV, tesselation etc. It presents very professional approach and does not over-simply anything for educational purposes (for example, the author uses linear space for color computations, explains HDR rendering and passes reciprocal value as constant where appropriate as multiplication is faster than division).
The book assumes that reader already knows DirectX API and is able to code a framework that loads meshes, textures, constant buffers and all the stuff and pass it to GPU rendering. He should also already know the concept of shaders and the HLSL syntax, not to mention math/geometry basics of 3D graphics (like properties of dot product or transformation matrix). So this is definitely not a book for complete beginners who want to learn game programming from scratch. It does not even give complete shaders to just copy-paste into your engine, but fragments (functions) that are interesting in some technique. Which I think is good, because where per-pixel parameters of your material come from (like albedo color, normal vector, specular intensity and exponent) - whether from texture, a constant or some computations - is up to you and the book focuses on what to do with it without boring, multipage code listings.
Subsequent chapters cover following topics:
That's not a "gems"-style book with every chapter being a separate article written by different author. But each chapter is a complete "recipe" for a rendering technique, whether an implementation of particular type of light or some other visual effect. Each one of them is divided into sections:
As you can see, described topics are not some sophisticated and specialized effects like rendering foam on an ocean coast or crowd on a stadium, but fundamental techniques needed by every engine. Just as the book says: "Lighting and postprocessing are two of the most important fields in 3D rendering."
Summary: This book is not intended for complete beginners, but if only it fits the knowledge you already have and the knowledge you currently seek, I think this it can be a great step on you path of learning game/graphics programming.
Now here is how you can have a chance to win eBook copy of this book: All you need to do is head on over to the book page, look through the product description of the book and then drop a line via the comments below this post to let us know what interests you the most about this book. 3 best comments win!!! Deadline: The contest will close in 1 weeks time. Winners will be contacted by email (before the end of this month), so be sure to use your real email address when you comment.