I guess it works for people with enough experience, but still, I find it odd.
Anyway it is free so I can't complain too much, subscribed.
I guess it works for people with enough experience, but still, I find it odd.
Anyway it is free so I can't complain too much, subscribed.
area = width * height
then a = w * h
As a simple example but it seems most programmers feel some sense of accomplishment the using the least number of characters and lines possible with no though to readability or maintainability.I'd much rather see
const areaOfRect = rect.width * rect.height;
const areaOfCircle = Math.PI * circle.radius ** 2;
if (areaOfRect > areaOfCircle) { ...
then if (rect.width * rect.height > Math.PI * circle.radius ** 2) {
...Even more controversial I'm not sure I like the new common pattern of destructuring as in
const {first, last, address, phone} = props;
...
...
<div class="name">{first} {last}</div>
<div class="address">{address}</div>
<div class="phone">{phone}</div>
vs <div class="name">{props.first} {props.last}</div>
<div class="address">{props.address}</div>
<div class="phone">{props.phone}</div>
Because the second style provides more info on each line. I know where the various values are coming from where as I don't with the first style.For example, ElasticSearch's NEST API client uses a fluent-style API to setup configuration and mappings. It started out well, but then I got lost in a forest of nested callbacks on various mystery objects. It was a bizarre way to build what should have been a tree of strongly-typed POCO's that have a 1-to-1 correlation with the server-side concepts. Worse, I didn't see a way to dynamically manipulate the (hidden) result. Better to use the low-level API and a little reflection to compose the required JSON manually.
[On the other hand, I can think of successful fluent API's: .NET's StringBuilder works because it is super simple (only returning instances of itself). The IEnumerable extension methods (created to support LINQ) work because their broad-applicability justifies the effort to learn.]
Sorry if I missed something but I also don't see an endorsement of bad variable names in the OP's handbook. The comment just seems a little out of place, thought I mostly agree with it.
Indeed, it's more common to write 'let the area be a, the width be w and the height h; then a = w * h' than it is to write 'area = with * height' when expositing in a maths textbook. This is a really hard habit for me to get out of, even when writing code.