The document discusses craftsmanship in software development. It provides examples of Wozniak's meticulous and perfectionist approach to engineering when designing Apple hardware and software. It also discusses different stages of craftsmanship like apprentice, journeyman, and master, and how these relate to becoming better at software development through continually learning, building, and improving skills. The emphasis is on cultivating high standards of quality and care in one's work.
5. “Woz designed all the hardware and all the circuit boards
and all the software that went into the Apple II… not one
bug has ever been found … the circuit design of the
Apple II is widely considered to be astonishingly
beautiful, as close to perfection as one can get in
engineering.”
-- Vikram Chandra Geek Sublime
49. Eye: What can you see?
Hand: What can you build?
Mind: What do you know?
50.
51.
52.
53. [The chipping paint] could be an
example of machine-cutting
"without sharp blades," adding
"it looks like they painted before
they actually cut the piece."
54. [The chipping paint] could be an
example of machine-cutting
"without sharp blades," adding
"it looks like they painted before
they actually cut the piece."
55.
56.
57. [The chipping paint] could be an
example of machine-cutting
"without sharp blades," adding
"it looks like they painted before
they actually cut the piece."
59. “Woz designed all the hardware and all the circuit boards
and all the software that went into the Appie II… not one
bug has ever been found … the circuit design of the
Apple II is widely considered to be astonishingly
beautiful, as close to perfection as one can get in
engineering.”
-- Vikram Chandra Geek Sublime
60. “Woz designed all the hardware and all the circuit boards
and all the software that went into the Apple II… not one
bug has ever been found … the circuit design of the
Apple II is widely considered to be astonishingly
beautiful, as close to perfection as one can get in
engineering.”
-- Vikram Chandra Geek Sublime
68. FizzBuzz:
Write a function that prints the numbers
from 1 to 20.
Print “Fizz” for multiples of 3
Print “Buzz” for multiples of 5
Print “FizzBuzz” for multiples of 3 and 5
69. FizzBuzz:
for (let i=1; i <= 20; i++) {
if (i % 3 === 0 && i % 5 === 0) {
console.log("FizzBuzz");
} else if (i % 3 === 0) {
console.log("Fizz");
} else if (i % 5 === 0) {
console.log("Buzz");
} else {
console.log(i);
}
}
70. for (let i=1; i <= 20; i++) {
if (i % 3 === 0 && i % 5 === 0) {
console.log("FizzBuzz");
} else if (i % 3 === 0) {
console.log("Fizz");
} else if (i % 5 === 0) {
console.log("Buzz");
} else {
console.log(i);
}
}
FizzBuzz:
Who cares?
71. function load($array) {
if(is_array($array)) {
foreach($array as $key=>$value) {
$this->vars[$key] = $value;
}
}
}
function unload($vars = '') {
if($vars) {
if(is_array($vars)) {
foreach($vars as $var) {
unset($this->vars[$var]);
}
}
else {
unset($this->vars[$vars]);
}
}
else {
$this->vars = array();
}
function fetch() {
$name= $argv[0];
$query = "SELECT id, $name FROM products;";
$result = pg_query($conn, $query);
}
function get_all() {
if($this->isAdmin) {
return $this->vars;
}
}
72. function load($array) {
if(is_array($array)) {
foreach($array as $key=>$value) {
$this->vars[$key] = $value;
}
}
}
function unload($vars = '') {
if($vars) {
if(is_array($vars)) {
foreach($vars as $var) {
unset($this->vars[$var]);
}
}
else {
unset($this->vars[$vars]);
}
}
else {
$this->vars = array();
}
function fetch() {
$name= $argv[0];
$query = "SELECT id, $name FROM products;";
$result = pg_query($conn, $query);
}
function get_all() {
if($this->isAdmin) {
return $this->vars;
}
}
73. function load($array) {
if(is_array($array)) {
foreach($array as $key=>$value) {
$this->vars[$key] = $value;
}
}
}
function unload($vars = '') {
if($vars) {
if(is_array($vars)) {
foreach($vars as $var) {
unset($this->vars[$var]);
}
}
else {
unset($this->vars[$vars]);
}
}
else {
$this->vars = array();
}
function fetch() {
$name= $argv[0];
$query = "SELECT id, $name FROM products;";
$result = pg_query($conn, $query);
}
function get_all() {
if($this->isAdmin) {
return $this->vars;
}
}
77. Understand Style
“When program statements were arranged in a
sensible order, experts were able to remember
them better than novices. When statements
were shuffled, the experts’ superiority was
reduced”
-- Steve McConnell Code Complete
78. Understand Style
function email() {
var form =
document.getElementById('contact-form');
var re =
/^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}
.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
for(input of form.elements) {if(input.test(re)) {
return input;
}
}
else{return false;
}
}
79. function AddToarray(arr, x)
{
var isInteger, updatedArr;
var val
isInteger = typeof x == 'number';
if (isInteger)
x = x + ''
var shoul_Add
if(Array.isArray(x)) {shoul_Add = false}
else {
shoul_Add=true
}
if(shoul_Add) {
if(x !== '14') {
arr.push(x);
}
}
return arr
}
80. function AddToarray(arr, x)
{
var isInteger, updatedArr;
var val
isInteger = typeof x == 'number';
if (isInteger)
x = x + ''
var shoul_Add
if(Array.isArray(x)) {shoul_Add = false}
else {
shoul_Add=true
}
if(shoul_Add) {
if(x !== '14') {
arr.push(x);
}
}
return arr
}
It works!
81. function AddToarray(arr, x)
{
var isInteger, updatedArr;
var val
isInteger = typeof x == 'number';
if (isInteger)
x = x + ''
var shoul_Add
if(Array.isArray(x)) {shoul_Add = false}
else {
shoul_Add=true
}
if(shoul_Add) {
if(x !== '14') {
arr.push(x);
}
}
return arr
}
Cultivate Dissatisfaction
82. function AddToarray(arr, x)
{
var isInteger, updatedArr;
var val
isInteger = typeof x == 'number';
if (isInteger)
x = x + ''
var shoul_Add
if(Array.isArray(x)) {shoul_Add = false}
else {
shoul_Add=true
}
if(shoul_Add) {
if(x !== '14') {
arr.push(x);
}
}
return arr
}
83. function AddToarray(arr, x)
{
var isInteger, updatedArr;
var val
isInteger = typeof x == 'number';
if (isInteger)
x = x + ''
var shoul_Add
if(Array.isArray(x)) {shoul_Add = false}
else {
shoul_Add=true
}
if(shoul_Add) {
if(x !== '14') {
arr.push(x);
}
}
return arr
}
Learn Community Standards
84. function AddToarray(arr, x)
{
var isInteger, updatedArr;
var val
isInteger = typeof x == 'number';
if (isInteger)
x = x + ''
var shoul_Add
if(Array.isArray(x)) {shoul_Add = false}
else {
shoul_Add=true
}
if(shoul_Add) {
if(x !== '14') {
arr.push(x);
}
}
return arr
}
Learn Community Standards:
Read Code
85. function AddToarray(arr, x)
{
var isInteger, updatedArr;
var val
isInteger = typeof x == 'number';
if (isInteger)
x = x + ''
var shoul_Add
if(Array.isArray(x)) {shoul_Add = false}
else {
shoul_Add=true
}
if(shoul_Add) {
if(x !== '14') {
arr.push(x);
}
}
return arr
}
Use A Linter
86. function addStringToArray(arr, value) {
const blackListedValue = '14';
if (Array.isArray(value)) {
return arr;
}
if (typeof value === 'number') {
value = value + '';
}
if (value !== blackListedValue) {
arr.push(value);
}
return arr;
}
87. function addStringToArray(arr, value) {
const blackListedValue = '14';
if (Array.isArray(value)) {
return arr;
}
if (typeof value === 'number') {
value = value + '';
}
if (value !== blackListedValue) {
arr.push(value);
}
return arr;
}
Readable.
Not Perfect.
89. <?
class House {
public $rooms = 3;
public function getRooms() {
return $this->rooms;
}
}
$h = new House();
$h->getRooms();
// 3
90. <?
class House {
public $rooms = 3;
static $bathrooms = 1;
public function getRooms() {
return $this->rooms;
}
static function getBathrooms() {
return self::$bathrooms;
}
}
$h = new House();
$h->getRooms();
// 3
$h::getBathroom();
// 1
91. <?
class House {
public $rooms = 3;
static $bathrooms = 1;
public function getRooms() {
return $this->rooms;
}
static function getBathrooms() {
return self::$bathrooms;
}
}
$h = new House();
$h->getRooms();
// 3
$h::getBathroom();
// 1
Code Review
92. <?
class House {
public $rooms = 3;
static $bathrooms = 1;
public function getRooms() {
return $this->rooms;
}
static function getBathrooms() {
return self::$bathrooms;
}
}
$h = new House();
$h->getRooms();
// 3
$h::getBathroom();
// 1
Why is this static?
93. <?
class House {
public $rooms = 3;
static $bathrooms = 1;
public function getRooms() {
return $this->rooms;
}
static function getBathrooms() {
return self::$bathrooms;
}
}
$h = new House();
$h->getRooms();
// 3
$h::getBathroom();
// 1
Uhh…..
94. <?
class House {
public $rooms = 3;
static $bathrooms = 1;
public function getRooms() {
return $this->rooms;
}
static function getBathrooms() {
return self::$bathrooms;
}
}
$h = new House();
$h->getRooms();
// 3
$h::getBathroom();
// 1
Be Deliberate
95. <?
class House {
public $rooms = 3;
public function getRooms() {
return $this->rooms;
}
static $bath_rooms = '1';
static function get_Bathrooms() {
$arr = [];
$arr.push(self::$bath_rooms);
if(false){
return self;
}
return self::$bath_rooms;
}
}
96. <?
class House {
public $rooms = 3;
public function getRooms() {
return $this->rooms;
}
static $bath_rooms = '1';
static function get_Bathrooms() {
$arr = [];
$arr.push(self::$bath_rooms);
if(false){
return self;
}
return self::$bath_rooms;
}
}
Do it again. Then
give it back to me.
97. <?
class House {
public $rooms = 3;
public function getRooms() {
return $this->rooms;
}
static $bath_rooms = '1';
static function get_Bathrooms() {
$arr = [];
$arr.push(self::$bath_rooms);
if(false){
return self;
}
return self::$bath_rooms;
}
}
Reviewers
98. <?
class House {
public $rooms = 3;
public function getRooms() {
return $this->rooms;
}
static $bath_rooms = '1';
static function get_Bathrooms() {
$arr = [];
$arr.push(self::$bath_rooms);
if(false){
return self;
}
return self::$bath_rooms;
}
}
Reviewers: You are
not being nice when
you withhold
feedback.
99. <?
class House {
public $rooms = 3;
public function getRooms() {
return $this->rooms;
}
static $bath_rooms = '1';
static function get_Bathrooms() {
$arr = [];
$arr.push(self::$bath_rooms);
if(false){
return self;
}
return self::$bath_rooms;
}
}
No feedback?
100. <?
class House {
public $rooms = 3;
public function getRooms() {
return $this->rooms;
}
static $bath_rooms = '1';
static function get_Bathrooms() {
$arr = [];
$arr.push(self::$bath_rooms);
if(false){
return self;
}
return self::$bath_rooms;
}
}
No feedback?
Write Test
109. Mind: Not as important as you think
In Shakespeare:
The top 10 most frequently occuring words make up
21.4% of all words.
The top 100 most frequently occuring words make up
53.9% of all words.
110. Mind: Not as important as you think
✔ Basics
✔ Things work (at least it seems so)
✔ Learning by reading/doing
131. 1. Get an array of unique items
2. Determines if a string starts
with an uppercase letter
3. Calculate the area of a circle
given radius
132. function getUniqueItems(arr) {
let unique = [];
for(let item of arr) {
if(!unique.includes(item)) {
unique.push(item);
}
}
return unique;
}
133. function getUniqueItems(arr) {
let unique = [];
for(let item of arr) {
if(!unique.includes(item)) {
unique.push(item);
}
}
return unique;
}
Cultivate Disatisfaction
134. function getUniqueItems(arr) {
let unique = [];
for(let item of arr) {
if(!unique.includes(item)) {
unique.push(item);
}
}
return unique;
}
You can look up
solved problems
144. const x = ['a', 'b', 'c'];
x.push('d');
x;
['a', 'b', 'c', 'd'];
What is the [X] way to solve the
problem?
145. const x = ['a', 'b', 'c'];
x.push('d');
x;
['a', 'b', 'c', 'd'];
What is the JavaScript way to
solve the problem?
146. const x = ['a', 'b', 'c'];
x.push('d');
x;
['a', 'b', 'c', 'd'];
What is the JavaScript way to
solve the problem?
mutation
147. const x = ['a', 'b', 'c'];
const y = [...x, 'd'];
y;
['a', 'b', 'c', 'd'];
x;
['a', 'b', 'c'];
What is the JavaScript way to
solve the problem?
148. const x = ['a', 'a', 'b', 'c'];
const copyX = [...x];
const combined = [...x, ...y];
const unique = [...new Set(x)];
What is the JavaScript way to
solve the problem?
149. What is the JavaScript way to
solve the problem?
const x = ['a', 'a', 'b', 'c'];
const copyX = [...x];
const combined = [...x, ...y];
const unique = [...new Set(x)];
No Mutations
156. Learn Principles
This was the book that showed me there were
names for so many patterns that I’d discovered
purely through fumbling around with my own code.
-- Rebecca Murphey on JavaScript Patterns
160. Learn Principles
… Before I created Rails, I redrew many of the
diagrams in OmniGraffle for Martin Fowler because
I liked the book so much
-- David on Patterns of Enterprise Architecture
161. Learn Principles
…The trick to reading this book is to carefully read
through every single refactoring pattern and then
try to apply it on your code base (you don’t have to
commit if it doesn’t fix things). You can’t just blow
through it or you won’t really learn it.
-- David on Refactoring
167. “We have included only designs
that have been applied more
than once in different systems…
Most … have never been
documented before”
-- Gang of Four Design Patterns
168. “How many times have you
had design déjà vu -- that
feeling that you’ve solved a
problem before but not
knowing exactly where or
how?
174. Rule of three:
“The first time you do something, you just do
it. The second time you do something similar,
you wince at the duplication, but you do the
duplicate thing anyway. Third you do
something similar, you refactor.”
-- Martin Fowler Refactoring
196. JavaScript
Brendan Eich was recruited to make Scheme into a
scripting language. Netscape partner Sun Systems
demanded it be similar to Java.
Brendan Eich wrote it in 10 days.
199. Linux
I'm doing a (free) operating system (just a hobby, won't be big and
professional like gnu)... This has been brewing since april, and is
starting to get ready. I'd like any feedback on things people
like/dislike in minix, as my OS resembles it somewhat (same
physical layout of the file-system...