Wednesday, November 22, 2017

JavaScript Notes

Objects and Prototypes

Notes from Jim Cooper's excellent PluraSight course on JavaScript Objects and Prototypes and Kyle Simpson's Advanced JavaScript class, and my random scribblings.

Use jsbin.com to play with JavaScript.

  1. Six Ways to Create Objects:
    1. Creating objects with Object Literals
      'use strict';
      var cat = {name: 'Fluffy', color: 'White'}
      console.log(cat.name); //Fluffy
      cat.age = 3; //we can create properties on the fly
      cat.speak = function() {console.log("Meeooow") }//add functions directly
      
    2. Creating objects with constructors:

      Calling "new" makes the function a constructor and does four magic things:

      1. Creates new object
      2. Sets the 'this' to its context
      3. Calls the function
      4. Returns a pointer to the new object

      Here's Jim's example:

      function Cat(name, color) {
        this.name = name
        this.color = color
      }
      var cat = new Cat('Fluffy','White');
      console.log(cat);
      
      This writes:
      [object Object] {
        color: "White",
        name: "Fluffy"
      }
      
    3. Creating objects with Object.create syntax Object.create()

      The "create()" method exists at the top level object cleverly named, "Object".

      Object.create(proto[, propertiesObject])
      

      "Object.create()" creates a new object and sets its prototype link to be the first parameter passed in. It also copies the properties from propertiesObject to the new object.

      The "new" keyword is just syntactic sugar, we could do the previous example like this:

      var cat = Object.create(Object.prototype,
      { 
      name: {
      value: 'Fluffy',
      enumerable:true,
      writable:true,
      configurable:true
      },
      color: {
      value: 'White',
      enumerable:true,
      writable:true,
      configurable:true
      }
      });
                             
      console.log(cat);
      
      o = {};
      //is shorthand for 
      o = Object.create(Object.prototype);
      
    4. A Fallback Polyfill for Older Browsers

      Older browsers may not have the "create()" method, so you can use a polyfill from developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create

      if (typeof Object.create !== "function") {
          Object.create = function (proto, propertiesObject) {
              if (!(proto === null || typeof proto === "object" || typeof proto === "function")) {
                  throw TypeError('Argument must be an object, or null');
              }
              var temp = new Object();
              temp.__proto__ = proto;
              Object.defineProperties(temp, propertiesObject);
              return temp;
          };
      }
      
    5. Creating objects with the new ECMAScript 6

      ES6 has new built in support for creating classes:

      'use strict';
      class Cat {
         constructor(name, color) {
            this.name= name
            this.color = color
         }
         speak() {
         console.log('Meeooow')
         }
      }
      
  2. Properties
    1. Bracket Notation

      Besides the dot notation, 'this.color = "blue"' you can use the bracket notation. An advantage of the bracket notation is that you can use property names with embedded spaces:

      cat['color'] = "blue";
      cat['Eye Color'] = "green";
      
    2. Descriptors

      JavaScript properties have 4 descriptors: value, writable, enumerable, and configurable.

      1. Value

        This is simply the actual "value" of the property.

      2. writable

        "writable" is a boolean that determines if the value can be written over.

        var cat = {name: 'Fluffy', color: 'White'}
        console.log(Object.getOwnPropertyDescriptor(cat, 'name')
        Object {
          value: Fluffy
          writable: true
          enumerable: true
          configurable: true
        }
        

        To set a property of field use defineProperty

        Object.defineProperty(cat, 'name', {writable: false})
        var cat = {
           name: {first: 'Fluffy', last: 'LaBeouf'}, color: 'White'
        }
        

        To prevent writing of an object:

        Object.freeze(cat.name)
        
      3. enumerable

        If "enumerable" set to false, the property will not show up in any list

        Object.defineProperty(cat, 'name', {enumerable: false})
        
        console.log(Object.keys(cat))
        
        console.log(JSON.stringify(cat))//will not show enumerable-false items
        

        How to Loop Over Enumerables:

        for(var propertyName in cat) {
          console.log(propertyName+':'+ cat[propertyName])
        }
        
      4. configurable

        If configurable is set to true you cannot change enumerable attr or configurable attr, or delete it, but can change writable attr.

        Object.defineProperty(cat, 'name', {configurable: false}
        
    3. Getters and Setters

      Let's create a new property and add a get() and set() methods.

      var cat = {
         name: {first: 'Fluffy', last: 'LaBeouf'}, color: 'White'
      }
      Object.defineProperty(cat, 'fullName',
      {
      get: function() {
        return this.name.first + ' ' + this.name.last
      },
      set: function(value) {
        var nameParts = value.split(' ')
        this.name.first = nameParts[0]
        this.name.last = nameParts[1]
      }
      });
      console.log(cat.fullName); //"Fluffy LaBeouf"
      cat.fullName = 'Top Cat'; //"Top Cat"
      console.log(cat.fullName);
      
  3. Prototypes and Inheritance
    1. We can add methods to individual objects. Here we create a 'last' method to an object, arr.

      'use strict';
      var arr = ['red','blue','green']
      Object.defineProperty(arr, 'last', {get: function() {
         return this[this.length-1];}});
      console.log(arr.last);//"green"
      

      But wouldn't it be nice to add a method to all arrays. We can by adding a method to 'Array's prototype which is shared by all the Array objects. If an individual object doesn't contain a function, it looks to its "prototype" to see if it has that function.

      'use strict';
      var arr = ['red','blue','green']
      Object.defineProperty(Array.prototype, 'last', {get: function() {
         return this[this.length-1];}});
      console.log(arr.last); //"green"
      console.log(['sour','sweet','bitter'].last); //"bitter"
      

      All functions have a built-in property that points to another object called "prototype".

      var myFunc = function() { }
      console.log(myFunc.prototype); //[object Object] { ... }
      

      Objects do not have a prototype property but they have a __proto__

    2. function Cat(name, color) {
        this.name = name;
        this.color = color;
      }
      
      var fluffy = new Cat('Fluffy','White');
      console.log(Cat.prototype);//[object Object] { ... }
      console.log(fluffy.__proto__);//[object Object] { ... }
      console.log(Cat.prototype === fluffy.__proto__);//true
      Cat.prototype.age = 4;
      console.log(fluffy.__proto__.age);//4
      

      Important: A function's prototype is the object instance that will become the default prototype for all objects created using this function.

      Jim has a great example of linking two classes, "Animal" and "Cat" into an inheritance chain. It's kinda tedious and error prone. Be very careful. This is why Kyle Simpson prefers OLOO. (more on that later).

      'use strict';
      function Animal(voice) {
        this.voice = voice || 'grunt';
      }
      Animal.prototype.speak = function() {
        console.log(this.voice)
      }
      
      function Cat(name, color) {
        Animal.call(this, 'Meow');
        this.name = name;
        this.color = color;
      }
      Cat.prototype = Object.create(Animal.prototype);
      Cat.prototype.constructor = Cat;
      var fluffy = new Cat('Fluffy','White');
      console.log(fluffy.__proto__.__proto__);
      

      This prints:

      [object Object] {
        speak: function () {
        window.runnerWindow.proxyConsole.log(this.voice)
      }
      }
      

      The above code is a little cleaner with the new ES6 "class" structure:

      'use strict'
      class Animal {
        constructor(voice) {
        this.voice = voice || 'grunt'
        }
        speak() {
          console.log(this.voice)
        }
      }
      
      class Cat extends Animal {
      constructor(name, color) {
        super('Meow');
        this.name = name;
        this.color = color;
        }
      }
      
      var fluffy = new Cat('Fluffy', 'White');
      fluffy.speak();//"Meow"
      

JavaScript Scope

My notes from Plurasight's Advanced JavaScript by Kyle Simpson. His series of online books is available on github at github.com/getify/You-Dont-Know-JS.

A good reference site for JavaScript is the Mozilla Developer Network MDM at https://developer.mozilla.org/en-US/docs/JavaScript

A good place to learn styles of programming JS is

https://github.com/rwldrn/idiomatic.js.

The actual definitive spec is at http://www.ecma-international.org/ecma-262/5.1

  1. Details of Scope

    Scope: where to look for things

    JavaScript is not interpreted. Bash is interpreted. The JS compiler goes through all the code before starting execution. It finds declaration of variables and puts them into appropriate scope slots. Finds "var" and "function"s.

    JS has function scope only (kinda).

    lhs - left hand side (target)

    rhs - right hand side (source)

    "undefined" really means uninitialized

    Kyle has a good way of explaining scope: When executing a function "foo" and encountering a variable "foo", JavaScript asks the question: "Hey, scope of 'foo' do you have a lhs reference to variable x?"

    For a function declaration, the first thing in the statement is "function name()".

    function bar() { ... }
    

    function expressions should have names

    var foo = function bar() { ... }
    

    Why use named functions and not anonymous?

    1. Can refer to itself for recurse
    2. Can find it in minified stack trace
    3. Is self-documenting
  2. eval

    "eval" cheats lexical scope. putting an "eval" in your code, forces the engine to run slower in strict mode, code is more optimizable. Don't use eval unless absolutely necessary.

    For example, using setTimeout with a string of code is bad practive since it invokes "eval()"; better to use with a function:

    setTimeout("console.log('hi')", 1000); 
    setTimeout(function () {console.log('bye');}, 2000); //ok with func pointer
    
  3. "with" is "more evil than eval"
    var obj = { a: 2, b: 3, c: 4 };
    with(obj) {//implies an obj.
    a = b + c;
    }
    

    "with" effects the scope and in strick mode, you can't use "with".

Immediately-invoked-function-expression (IIFE) pattern

This is a widespread pattern in JavaScript with a history here: benalman.com/news/2010/11/immediately-invoked-function-expression. It forces a function to run immediately - hense the catchy name.

var foo = "outside";
(function() {
  var foo = "inside";
  console.log("foo:"+foo)//prints "inside"
})();

"let" (ES6) and block scope

"let" will set the scope of the variable to the "for" loop (or outer braces), not the function scope as "var" would have done. creates an implicit block on the "for".

function foo() {
  for(let i=0; i<var.length; i++) {
    ...
  }
}

warnings: "let" is not hoisted. If in the middle of an if statement block, the variable is only available after the "let". The area above the "let" declaration where the variable is not defined is called the "Temporal Dead Zone".

How to get a new scope? create a function, catch, or a brace with the "let" in ES6

"undefined" is a value, meaning a variable doesn't currently have a value.

"undeclared" never been declared. reference error.

hoisting

during compile phase, functions and then declarations are "hoisted" to the top.

var a=6;
function foo() { ... }

The compiler rearrages and hoists declarations to top

function foo() { ... }
var a;
a=6;

Why hoisting? mutual recursion would be impossible. like c header files.

The "this" pointer

Four Rules for how the 'this' keyword get bound.

Every function, while executing, has a reference to its current execution context called "this".

The value of the "this" pointer depends on the call site i.e., where the method gets invoked.

BTW, "this" is not like "this" in any other language.

  1. new

    "new" turns a function into a constructor call and sets the this pointer

    The "new" constructor does four things:

    1. A brand new empty object will be created
    2. The new object gets linked to another object
    3. The new object gets bound as the "this" keyword for the function call
    4. If the function doesn't return something, it will return "this"
  2. Explicit binding Rule

    .call() or .apply() take as their first arg "this"

    example of hardcoding

    function foo() { console.log(this.bar); }
    var obj = { bar: "bar" };
    var orig = foo;
    foo = function() { orig.call(obj); } //forces this context on foo
    foo.call(obj)
    

    utility to do hardbinding:

    function bind(fn,o) {return function() { fn.call(o); };}
    function foo() { console.log(this.bar); }
    var obj = { bar: "bar" };
    foo = bind(foo,obj);
    foo();//bar
    

    put bind on Function prototype

    if(!Function.prototype.bind2) {
      Function.prototype.bind2 =
        function(o) {
          var fn = this; //the original function
          return function() {
            return fn.apply(o,arguments);
          };
        };
    }
    var obj = { bar: "bar" };
    foo = foo.bind2(obj);
    foo("baz");
    

    ES5 has a builtin "bind"

    hardbind makes "this" be predictable
  3. Implicit binding Rule

    - object calling function becomes the "this"

  4. Default Binding Rule

    in strict mode, default "this" is set to the undefined value

    not in strict, "this" defaults to global, which in browser is window

Summary: Four Questions to determine what is the "this" object
  1. Was the function called with the "new" keyword? use that object.
  2. Was it called with .call() or .apply(). Use explicit object
  3. Was the function called with an owning object? use that.
  4. Default: global object (except in strict mode)

Details in his second book "You Don't Know JS.com" - chapter 2

Closure

Closure comes from Lambda calculus. Closure is when a function "remembers" its lexical scope even when the function is executed outside that lexical scope.

function foo() {
  var bar = "bar";
  function baz() {
     console.log(bar);
  }
  bam(baz);
}

function bam(baz) { baz(); }
foo();

//calling a method that returns a method that retains lexical scope (Closure)
function foo() {
  var bar = "bar";
  
  return function() { 
  console.log(bar);
  };
}

function bam() {
    foo()();  //call the returned method
}

bam();

The Classic Closure Example

for(var i=1; i<=5; i++) {
  setTimeout(function() {
    console.log("i: "+i);//writes 6 since i references outer scope
  },i*1000)
}


for(var i=1; i<=5; i++) {
  (function(i) {//use an IIFE
  setTimeout(function() {
    console.log("i: "+i);//writes 1,2,3,4,5
  },i*1000);
  })(i);
}

Classic Module Pattern

Two Characterics of Classic Module Pattern

1. Must have outer function wrapper

2. One or more functions that are returned that have closure over inner scope to access variables

example of module pattern

var foo = (function() {
  var o = {bar: "bar" };
  return {
    bar: function() {
      console.log(o.bar);
    }
  };
})();
foo.bar();
 
//example of modified module pattern
var foo = (function() {
  var publicAPI = {
    bar: function() {
      publicAPI.baz();
    },
    baz: function() {
      console.log("baz");
    }
  };
return publicAPI;
})();

foo.bar()

Object Orienting

OO Design Patterns

  1. Prototype

    Every single "object" is built by a constructor function.

    Each time a constructor is called, a new object is created.

    A constructor makes an object linked to its own prototype. (In class-based system, new objects are instantiations of the class)

    An object has a link called ".prototype" pointing to its prototype object. The prototype object has a link back to the object called ".constructor"

    A object has a private link called "[[Prototype]]" which points to its prototype object.

    Three ways to get a "new"'d object's prototype.

    1. A object in all browsers except IE has a public link called "__prototype__" (called DunderProto) which points to its prototype object.(in ES6, adopted in IE11)

    2. The standard way to get an object's prototype is "Object.getPrototypeOf(o)" (in IE9, ES5)

    3. For IE8 (ES3): o.constructor.prototype (but .constructor and .prototype are writtable)

    A function has a [[Prototype]] link (__proto__ in ES6 and all browsers except IE below 10) to the object "Function"'s prototype which contains "call()", "apply()", and "bind()".

  2. Inheritance

    Classical inheritance copys the class to make object. Instead use "Behavior Delegation".

    OLOO - Objects Linked to Other Objects

    function Foo(who) {
    	 this.me = who;
    }
    Foo.prototype.identify = function() {
      return "I am " + this.me;
    };
    function Bar(who) {
    	 Foo.call(this,who);
    }
    Bar.prototype = Object.create(Foo.prototype);
    Bar.prototype.speak = function() {
        alert("Hello, " + this.identify() + ".");
    };
    var b1 = new Bar("b1");
    b1.speak(); //alerts: "Hello, I am b1."
    
    //a slight improvement
    var b1 = Object.create(Bar.prototype);
    Bar.call(b1,"b1");
    b1.speak();
    
    //moving forward
    bar b1 = Object.create(Bar);
    b1.init("b1");
    b1.speak();
    

Monday, November 13, 2017

Building Beautiful RESTful APIs in .Net Core - Adnug November Meeting

Nate Barbettini talked to 26 developers at the Austin .Net Users Group.



Here's my notes from his talk:
RPC (Remote Procedure Call) vs. REST (REpresentational State Transfer)
RPC endpoints are verbs (api.example.io/getUrser), in REST endpoints are resources (/User)

HATEOAS - hypermmedia as the engine of application state
Data exchange should be treated as if the client were a web browser
No documentation or out-of-band info needed

Use RPC when dealing with a simple object, like the Slack API
Use REST when dealing with lots of different objects with CRUD operations possible on all of them
GraphQL is useful when trying to traverse a graph of REST calls

REST + JSON is popular but hard because no schema is available for the data.
HAL and JSONSchema try to solve that.  Also Ion trys to give structure to JSON data.
The Ion content type is application/ion+json
Ion data is embedded in JSON with fields, like "href","rel", and "value".

ASP.NET Core is a full rewrite of .Net to be portable, faster and cleaner.
Dependency Injection is now in the framework, don't have to download StructureMap

Nate has a free eBook about starting with .Net Core at https://www.recaffeinate.co/
Demo to create new .Net Core API with Web API template.  No diff between MVC or API controllers.

Nate used package Entityframework inmemory to do development of demo.  inmemory just gives an inmemory

ASP.NET Core is friendly to async/await pattern.  async first philosophy.

@nbarbettini
 https://www.recaffeinate.co/

Nate has a Lynda.com course on this.
https://github.com/nbarbettini/BeautifulRestApi is the result of his 4 hour Lynda course.

Nate has done a great job of learning .NET Core and sharing his knowledge with the community free of charge.



Wednesday, November 01, 2017

Just Switched Electrical Providers to Our Energy LLC Using GeekYourRate.com

In Texas we can choose our electrical provider.  PowerToChoose.org is a website to help consumers pick a provider, but it's very difficult to find which provider is the cheapest for me, since providers have a complex rate structure.  I did a previous blog post on choosing an electric provider.

I've found a great website, GeekYourRate.com, which cuts through all the weird pricing structures and shows the best rate for your usage.  The service costs $10, but it saved me $150 for the next year.
GeekYourRate.com said my cheapest option was Our Energy LLC, so I switched.   I had not heard of them before,  but will let you know how they work out.

Be careful not to just continue with your "current" provider when your time is up.  I think they are tempted to offer you a decent plan, but not the best, since it's such a hassle to change.  When I called my provider, and said that I had found a better rate, they offered me a better rate plan than what was mailed to me to renew. 

Here's my results from GeekYourRate.com:

 

Saturday, October 28, 2017

Saving for Retirement

The Basics of Saving for Retirement

I know, I know, I've waited to long to have "the talk" with my daughter who is a Junior in college. But something else always came up. The time never seemed right and I felt awkward, but I finally sat down with her and told her what I wish I'd known at her age about finances. I would be much further along in retirement savings if I'd just known these facts.

You can work hard all your life, put lots of money into your savings, but can still end up with a poor retirement if you don't save well.  Save wisely and you can enjoy a wonderful retirement.

How much money do you need to retire? 
The Four Percent Rule. The typical rule of thumb is that you can take out 4% of your money every year for your retirement.  So if you need $40,000 dollars a year from your savings, you will have to save one million dollars by retirement age.  That's a lot of money and it doesn't just happen.

General Tips
1. Don't buy toys on credit.   Credit cards carry a huge interest rate and you will be losing money every time you have a balance at the end of the month.  Pay your credit cards off at the end of the month.  Buy clothes at Goodwill, eat frugally, take local vacations, drive an old car, use a Windows computer - do what you must, but never carry a balance on your credit cards.

Your home and cars are the only things you should buy on credit.  Save up your money so you don't have to buy cars on credit.

2. Use a Credit Union.  Banks are made to provide profits for their owners, the stock holders.  Banks try to wring every last cent from you.  Credit Unions belong to the depositors and hence try to serve you, the depositor.  That being said, sometimes banks can provide services like ATMs everywhere that make them worth a second look, but remember banks live to make other people money.

Bankers circling to figure out ways to charge more fees
Basics of Investing
1.  You get paid for risk.  Since inflation runs about 2% a year, if you put your money in the bank in a risk-free FDIC insured account at 0.05% interest, you are losing money every year.  You need to take more risk to earn more money.

2. What is the stock market?  When you own a stock, you own a little piece of the company.  When the company makes a profit for the year they will pay you a tiny part of that profit which is called a dividend.  If a company has a million stock shares, and you own one stock, you will get one-millionth of their profits for the year.  Although some companies don't pay dividends, but let their stock price rise instead.  Either way you can make money.

3. Stocks are risky. If the company goes bankrupt you can lose all the value of your stock.  But with greater risk comes greater reward.  The stock market averages about 8% returns a year.

4. What are stock funds?  Stock funds are composed of a group of other stocks.  It's like a basket of baskets; when you buy a stock fund (big basket), you buy a small piece of multiple stocks (little baskets).  Two types of funds exist, managed and indexed.  Managed funds buy stocks based on the opinion of a highly paid stock picker.  Index funds buy stocks based on an list, like the 500 biggest companies in the stock market (the S&P 500 list) or the 1000 biggest companies (the Schwab 1000).

Index funds will almost always beat managed funds because managed funds have a higher expense, like 1-2% of all your money, while index funds may only charge you .03% of your money invested in them.  Over the decades this tiny difference can amount to over a hundred thousand dollars.





Don't invest in individual stocks, buy index stock funds. Individual stocks are fun to play with, but they're not stable enough to warrant high-stake investments.

You can buy stocks and bonds at a company like Vanguard or Schwab.  You create an account and send them money and they will buy and hold the stocks and bonds for you.

4. What are bonds?  Companies borrow money from investors by selling bonds. They are like government savings bonds - you buy them now and can redeem them later with interest. While bonds earn interest and are safer than stocks, they don't earn as much potential profit.  When a company goes bankrupt the bond holders get their money before stock owners, less risk so less reward.  Government bonds are the safest investment, but only pay about 1.5 - 2% returns.

6. Diversify.  You should own a mix of stock index funds and bonds in case the stock market goes way down.

What percentage in stocks?  One rule of thumb is to have the percentage of stocks the same as (120-your age), so at age 50 you should have 70% of your savings in stocks, both domestic and foreign.  When you are 20 you should be 100% in stocks, since you have a lot of time to ride out the ups and downs in the market.
You should also diversify over countries.  Have some stock and bonds from other countries.
 John Bogle, founder of the Vanguard Group which champions low cost index funds recommends this set of funds:
40% in the Vanguard Total U.S. Stock Market Index Fund
20% in the Vanguard Total International Stock Market Index Fund
40% in the Vanguard Total Bond Market Index Fund

7. Dollar cost averaging and beating the market.  Trying to invest money in the stock market when you think it is low, and selling when you think it is high almost never works.  Instead, invest every month when its going up and down and just ride out the storms.

The S&P 500 in 2008 was around 1500 and dropped to 700.   Many of my friends sold their stocks and lost half their investments.  If they would have been patient, they would have made all that money back and then some since the market has recovered to 2500.

8.  Real Estate.  You can invest in real estate, but it takes time to manage.  Your own home is typically, but not always, a good investment.  Another way to invent in real estate is a Real Estate Investment Trust (REIT), which is like a stock, but it invests in real estate like apartments, shopping malls, office buildings, and homes.  This is the simplest way to own real estate.

9.  Invest in ways that minimize your taxes.  Your work will typically have a Retirement 401(K) plan that will allow you to invest money without it first being taxed.  They will typically match a part of your investment, like the first 4% of your salary.  You get to deduct the amount you invest from your income so you don't have to pay taxes on it, yet.  When you retire you will pay taxes when you pull money out, but the money has grown for 30 years without paying taxes.

If your company doesn't offer a 401K, you can invest in an IRA, or a ROTH account. If you invest in an IRA, it is untaxed going in, allowing for compounding interest on the full amount you put in, but taxed when you withdraw money from the account. If you invest in a ROTH account, money is taxed going in, but considered non-taxable income when withdrawn.

10.  How much to save?

As a general rule you should try to 15% of your salary for retirement. The following table shows how far along you should be at a particular age to be on track.

Age Save this multiple of your salary
30 1x
40 3x
50 6x
60 8x
67 10x

In Summary
Save 15% of your salary for retirement every month in a mix of domestic and international stock index funds and bond funds into your company 401K or a ROTH account.


Planning and saving for your future is hard work, but your 65 year old self will thank you.


Friday, October 20, 2017

Agile Austin Lunch Session - How Microsoft VSTS went from 18 mo Releases to Three Week Sprints

Clementino de Mendonça presented to 20 Agile Austiners on the topic "Agile at Scale SIG - Agile Transformation at Microsoft TFS/VSTS team".

Microsoft uses 3 week sprints with releases to different test environments named  Ring 0 to Ring 6.
Releases every 3 months, could be more frequent, but customers don't want it more frequently.

Microsoft's internal release notes for VS are available at https://www.visualstudio.com/team-services/release-notes/

How did they go from 18 month release cycle to daily?

In the old days it took 3 months of planning to organised details for the next release.  Developers coded in two week sprints, with stand ups.
The lower levels were Agile, but the upper level planning was not.

Before and After Microsoft Transformations:
4-6 month milestones to 3 week sprints
Personal offices to Team rooms
Long planning cycles to Continual Planning and Learning
Feature Branches to everyone in master branch with tags
Secret road map to publicly shared road map on the web
100 page specs to specs in PPT
Private repos to open source publicly available
Deep hierarchy to flat hierarchy

"Culture eats strategy for breakfast", Peter Drucker

Microsoft at one time was cutting edge on Agile (Ken Schwaber studied them for the creation of Scrum), but then lost it.

Microsoft looked at Pink's book "Drive". People want Autonomy, Master, and Purpose.
Youtube video summary here,

Alignment and Autonomy balance.  Too much alignment and the autonomy falters.

MS changed Roles.  In the old days developer testers were considered lower quality.
Used to have Program Management, Dev, and Testing.  Now only PM and Engineering.  Everybody writes tests - no separate testers.

Full list of roles:  UX / User Experience / Program Management / Engineering / Service Delivery.

PM is responsible for What and Why building.  Engineering is responsible for How.

Teams are cross discipline, 10-12 people, self managing, clear goals, lasts for 12-18 months, work in physical team rooms.
The team owns the features in production and own deployment.  So if problems occur, that team fixes the problem.

Instead of doing horizontal layers: teams doing UI other team doing API, others doing business logic.
Now, one team does all of those things in a vertical slice.

Autonomy - let teams choose what they want to work on.  They must train successors.  aka.selfformingteams

800 people working on VS.  Teams stay in contact with each other using "Sprint Mails" detailing what they did, and what they plan to do next sprint.  This is instead of big meetings.


Lightweight Planning: Sprints in 3 weeks, Plan in 3 sprints, Season is 6 months, and Strategy in 12 months.

Strategy / Features / Stories / Tasks.  Strategy comes from top down.

Backlog is taken from UserVoice, community requests and voted on.

Stabilization sprint used to happen.  Devs would push bug fixes to stabilization sprint instead of fixing immediately.

Bug Cap is total number of bugs to have, it's five times number of devs.

Takeways
1. Get good a science, but don't be overly prescriptive.
2. Stop celebrating activity, start celebrating results.
3. Embrace the new normal.  Delivery continuously.
4. You can't cheat shipping.  Putting into production.
5. Build the culture you want ... and you'll get the behavior you're after.





Wednesday, October 11, 2017

Agile Austin, Oct 10, 2017 - Rage, Disorder, and Your Agile Team

At Agile Austin this month Matt McBride from Genesis10 talked about Agile team culture at Kasasa.com headquarters.
He wrote Leadership Patterns for Software and Technology Professionals.


My random notes:
* Rage, Stress, and Its Impact
Rage is one specific behavior that our teams are exposed to in their daily lives.
Rage and anger are types of stress.  Rage and anger are specific instantiations of the "abstract class" named stress.

What is impact of stress?: Health, Behavior, and relationships with our team members.
Stress can be a good thing for short periods.

Cortisol is the chemical produced during stress.  Long-term Cortisol can shrink your brain.
Sources of Anger: disappointment, frustration, judgement, rejection fear.

Anger make people indiscriminately punitive.

* Threat of Architectural Disorder
complexity grows at an exponential pace
Nonfunctional features (security, testing ...) tend to get lost or ignored
Grady Booch on characteristics of successful projects: strong architectural vision and well-managed iterative cycle (scrum).

Major Classes of Program Features to  Think about At the Beginning
1. Significant features for business/customer
   We look for functional features with a high business risk
2. Architecturally significant features
    We look for functional and non-functional features with high technical risk.

From Agile we need to embrace these:  commitment, courage, focus, openness and respect.

Missing in college education is leadership skills.  How to educate non-technical customers.


Leadership:
1. Leaders are avid learners.
Leaders try, fail, learn, and grow.
2. Leadership is a choice.
We have to change the way we think about ourselves, careers, and work.

* Tactics for reducing anger, rage, and stress
Have everyone take one deep breadth
Then followup with a specific goal

Partnership Pattern - moving forward from newbie to Trusted Partner
1. Performance - establish record of success
2. Credibility - be trusted based on performance
3. Trust -
4. Become a Trusted Partner

* The resolute pattern
Recast problems as assumptions to be questioned

Invest in your team and in development of leadership and interaction skills.




Monday, October 09, 2017

Continuous Integration and Delivery with Visual Studio and Azure - Austin .Net Users Group October 9, 2017

Shawn Weisfeld (Shawn is also founder of http://UserGroup.tv) created and deployed a project from scratch at the Austin .Net Users Group. VisualStudio.com gives us a free repository. You can create a project stored in the cloud. Team Services is free for teams under 5 people. Visual Studio online and VS local easily share a repository by default. ms.portal.azure.com will host. You chose how many machines and the size of the machines. Azure will create a load-balancer for the cluster. Azure will automatically collect telemetry. Changing the environmental variables on production is easy - you don't have to create multiple versions of the web.config for each environment. Shawn showed how it really is insanely easy to deploy an app in Azure to cluster using VisualStudio.com, Azure.com and a local copy of Visual Studio 2017.