Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Craftsmanship: it's important!

Craftsmanship: it's important!

The slides for my Detroit Craftsman Guild talk about why craftsmanship is important.

Amber Conville

August 26, 2014
Tweet

More Decks by Amber Conville

Other Decks in Programming

Transcript

  1. wait, who the hell are you? i’m amber conville! you

    can find me on the internet at these places: i develop software here, at detroit labs, which is an awesome place! twitter: @crebma
 email: [email protected]
 github: crebma
 other stuff: i’ll bet you can guess!
  2. ok cool, that all sounds neat. so what can i

    do to start learning about and practicing craftsmanship?
  3. expect others to read your code, and preemptively make it

    easy to figure out whats going on. wait, how?
  4. public class Thinger() { protected int thingerType; public int doStuff(int

    baseStuff) {
 if(thingerType == 4) {
 return baseStuff * 8;
 } else if (thingerType == 2) {
 return baseStuff * 12;
 } return baseStuff * 2;
 }
 } public class FourThinger extends Thinger() { public FourThinger() {
 this.thingerType = 4;
 } } public class TwoThinger extends Thinger() { public TwoThinger() {
 this.thingerType = 2;
 } }
  5. public class Thinger() { public int doStuff(int baseStuff) {
 return

    baseStuff * 2;
 } } public class FourThinger extends Thinger() { @Override
 public int doStuff(int baseStuff) {
 return super.doStuff(baseStuff) * 4;
 } } public class TwoThinger extends Thinger() { @Override
 public int doStuff(int baseStuff) {
 return super.doStuff(baseStuff) * 6;
 } }
  6. public class Rectangle { private int width;
 private int height;

    public void setWidth(int width) {
 this.width = width;
 } public void setHeight(int height) {
 this.height = height;
 } public int getArea() {
 return this.width * this.height;
 } }
  7. @Test
 public void rectangleWithSidesOf5And10HasAreaof100() {
 Rectangle rectangle = new Rectangle();


    rectangle.setWidth(5);
 rectangle.setHeight(10); int area = rectangle.getArea(); assertThat(area, equals(50)); //pass! yay!!
 }
  8. public class Square extends Rectangle { public void setWidth(int width)

    {
 super.setWidth(width);
 this.height = width;
 } public void setHeight(int height) {
 super.setHeight(height)
 this.width = height;
 } }
  9. @Test
 public void rectangleWithSidesOf5And10HasAreaof100() { Rectangle rectangle = new Square();


    rectangle.setWidth(5);
 rectangle.setHeight(10); int area = rectangle.getArea(); assertThat(area, equals(50)); //fail! oh nooooo, it's 100! i am so surprised right now as a consumer of this object that i have to go look at the code to see what is going on!
 }
  10. stuff to do go to user groups, or organize them.

    there are tons of them in south east michigan, so look at meetup! pair with new people you don't work with all the time. go to conferences all over the place about all kinds of things, not just your favorite technology. speak at groups and conferences.