Skip to content

Commit c394e78

Browse files
Merge commit '6105c4887434c4565d07ff9269a2db0c537a0a53' into 05_Concurrency
# Conflicts: # better-code/00-preface.md # better-code/01-types.md
2 parents df7dbea + 6105c48 commit c394e78

File tree

9 files changed

+29
-24
lines changed

9 files changed

+29
-24
lines changed

_posts/2020-02-26-revisionist-history-of-move.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Compare the description for the old [SGI STL LessThanComparable concept](http://
4747
> We need wording to state that these are requirements for operations with the domain of values passed to the STL component. Borrowing from [the text for input iterators](http://eel.is/c++draft/iterator.cpp17#input.iterators-2):
4848
{: .comment }
4949

50-
> The term _domain_ of an operation is used in the ordinary mathematical sense to denote the set of values over which an operation is (required to be) defined. This set can change over time. Each component may place additional requirements on the domain of an operation. These requirements can be inferred from the uses that a component makes of the operation and is generally constrained to those values accessible through the arguments of the operation. \[ _Example:_ The call `find(a, b, x)` is defined only if the value of `a` has the property _p_ defined as follows: `b` has property _p_ and a value `i` has property _p_ if (`*i == x`) or if (`*i != x` and `++i` has property _p_). _— end example_ \]
50+
> The term _domain_ of an operation is used in the ordinary mathematical sense to denote the set of values over which an operation is (required to be) defined. This set can change over time. Each component may place additional requirements on the domain of an operation. These requirements can be inferred from the uses that a component makes of the operation and is generally constrained to those values accessible through the operation's arguments. \[ _Example:_ The call `find(a, b, x)` is defined only if the value of `a` has the property _p_ defined as follows: `b` has property _p_ and a value `i` has property _p_ if (`*i == x`) or if (`*i != x` and `++i` has property _p_). _— end example_ \]
5151
{: .proposed}
5252

5353
### Option 1

better-code/00-preface.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ tags: [ better-code ]
55
chapter: 0
66
---
77

8-
To understand what _better code_ is we first need to understand what _good code_ is. Students are often taught that good code is code that does what the specification says it should. But such an answer begs the question of what is a good specification? Nearly every experienced developer I've met has a snippet of code filed away that has profound beauty - it likely has no corresponding specification and may not even contain a single comment. So what is good code?
8+
To understand what _better code_ is, we first need to understand what _good code_ is. Students are taught that good code is code that does what the specification says it should. But such an answer begs the question of what is a good specification? Nearly every experienced developer I've met has a snippet of code filed away that has profound beauty - it likely has no corresponding specification and may not even contain a single comment. So what is good code?
99

10-
By working through this book and applying the ideas within I hope that you will gain a deeper understanding of what good code is, and in striving to write good code you will write better code.
10+
By working through this book and applying the ideas within, I hope that you will gain a deeper understanding of what good code is, and in striving to write good code, you will write better code.
1111

12-
This book presents a collection of software development goals. The word _goal_ was chosen carefully. These are not guidelines or rules, and achieving the goal is not always simple or straightforward. Each goal is phrased such that it is not prescriptive, and often states what not to do, but what _to do_ is an open-ended challenge. You will find that while trying to apply these goals you will sometimes fail, but through the effort you will gain a deeper understanding of your code and learn to write _better code_.
12+
This book presents a collection of software development goals. The word _goal_ was chosen carefully. These are not guidelines or rules, and achieving the goal is not always simple or straightforward. Each goal is phrased such that it is not prescriptive and often states what not to do, but what _to do_ is an open-ended challenge. You will find that while trying to apply these goals, you will sometimes fail, but through the effort, you will gain a deeper understanding of your code and learn to write _better code_.
1313

14-
The examples in this book are primarily in C++, this is for two reasons. The majority of my professional career has been spent writing C++ code. I also believe it is the best mainstream language with which to present the ideas within, but at times I will point out some significant shortcomings. The ideas in this book are not limited to the C++ developer, but apply equally if you are programming in any other language. Where I think there is value in illustrating this point I provide examples in other languages. <!-- REVISIT: It may just be JavaScript as the other language, as yet undecided -->
14+
The examples in this book are primarily in C++ for two reasons. The majority of my professional career has been spent writing C++ code. And C++ is the best mainstream language to present the ideas within, but I will also point out some significant shortcomings. The ideas in this book are not limited to the C++ developer but apply equally to other languages. Where I think there is value in illustrating this point, I provide examples in other languages. <!-- REVISIT: It may just be JavaScript as the other language, as yet undecided -->
1515

1616
<!--
1717
1818
Format for each chapter:
1919
20-
short introduction that provides motivation
20+
a short introduction that provides motivation
2121
explain the problem
2222
show examples
2323
define the goal

better-code/01-types.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ And an _object_ is defined as:
2020

2121
> An object is a representation of an entity as a value in memory. {::comment}Add reference to section 1.3 of Elements of Programming{:/comment}
2222
23-
The fact that an object exists _in memory_ is important. Objects are physical entities and as such are governed by the laws of physics, despite being oft referred to as _virtual_.
23+
The fact that an object exists _in memory_ is important. Objects are physical entities and are governed by the laws of physics, despite being oft referred to as _virtual_.
2424

25-
The basic building block for modern computers is the transistor. A transistor is a solid-state electronic switch. Prior to the use of transistors (the first transistor-based computer was built in 1953{::comment}Citation{:/comment}) computers were built with vacuum tubes, relays, or gears. {::comment}citation{:/comment} Any device that can serve as a controlled switch can be used to build a computer.
25+
The basic building block for modern computers is the transistor. A transistor is a solid-state electronic switch. The first transistor-based computer was built in 1953{::comment}Citation{:/comment}. Prior to the use of transistors, computers were built with vacuum tubes, relays, or gears. {::comment}citation{:/comment} Any device that can serve as a controlled switch can be used to build a computer.
2626

2727
{% include figure.md name='transistor' caption='Transistor' %}
2828
{% assign figure-transistor = figure-index %}
2929

30-
The symbol for a simple transistor is shown in {{figure-reference[figure-transistor]}}. A voltage applied to the base allows current to flow from the collector to the emitter.
30+
The symbol for a simple transistor is shown in {{figure-reference[figure-transistor]}}. Applying a voltage to the base allows current to flow from the collector to the emitter.
3131

3232
{% include figure.md name='relay' caption='Relay' %}
3333
{% assign figure-relay = figure-number %}

0 commit comments

Comments
 (0)