anchor.diff:    }
   }
   
  -void setBadgeName(String newName) {
  -  querySelector('#badgeName').text = newName;
  +void setBadgeName(PirateName newName) {
  +  querySelector('#badgeName').text = newName.pirateName;
   }
   
   void generateBadge(Event e) {
  -  setBadgeName('Anne Bonney');
  +  setBadgeName(new PirateName());
  +}
  +
  +class PirateName {
  +  static final Random indexGen = new Random();
  +  String _firstName;
  +  String _appellation;
  +  
  +  static final List names = [
  +    'Anne', 'Mary', 'Jack', 'Morgan', 'Roger',
  +    'Bill', 'Ragnar', 'Ed', 'John', 'Jane' ];
  +  static final List appellations = [
  +    'Jackal', 'King', 'Red', 'Stalwart', 'Axe',
  +    'Young', 'Brave', 'Eager', 'Wily', 'Zesty'];
  +  
  +  PirateName({String firstName, String appellation}) {
  +    if (firstName == null) {
  +      _firstName = names[indexGen.nextInt(names.length)];
  +    } else {
  +      _firstName = firstName;
  +    }
  +    if (appellation == null) {
  +      _appellation = appellations[indexGen.nextInt(appellations.length)];
  +    } else {
  +      _appellation = appellation;
  +    }
  +  }
  +  
  +  // Getter.
  +  String get pirateName =>
  +      _firstName.isEmpty ? '' : '$_firstName the $_appellation';
   }
positive.code: // for details. All rights reserved. Use of this source code is governed by a
  // BSD-style license that can be found in the LICENSE file.
  import 'dart:html';
  
  ButtonElement genButton;
  
  void main() {
  
negative.code: 
  void updateBadge(Event e) {
    String inputName = (e.target as InputElement).value;
    setBadgeName(new PirateName(firstName: inputName));
  
    if (inputName.trim().isEmpty) {
      // To do: add some code here.
      genButton..disabled = false
  