         Builder = ActionOverride
       when 'listViews'
         Builder = ListView
+
+# shouldn't happen if our training set is large
       else throw new Error "unknown tag type #{tag.tag}"
+
     thing = new Builder()
+
     tag.getchildren().forEach (child) ->
       thing.set child.tag, child.text, child
+
+# this is a particular special case...
     thing.finishBuild() if thing.finishBuild
     thing
 
 factory = new Factory()
 
+# each tag type that has child nodes has a class
+# this is one top-level class
 class SObject
   constructor: ->
+
+# maps of child elements by their name
+# only elements that have themselves children
+# (and thus are classes)
     @fields = {}
     @actionOverrides = {}
     @listViews = {}
 
+# primary method for filling up data
   set: (field, value, tag) ->
     switch field
     # named children
+
+# we will use the fact that the name field always
+# ends with 'Name' i guess
       when 'fields'
         field = factory.build tag
         @fields[field.fullName] = field

      return obj is 'true'
    obj

class Picklist
  constructor: (tag) ->
    @sorted = tag.find('./sorted').text is 'true'

'use strict'

# when a tag comes up with child nodes, decide which one
# to create to hold those children
class Factory
  build: (tag) ->
    switch tag.tag
      when 'CustomObject'
        Builder = SObject

# note the class names are the tag names, but
#  - capitalized
#  - trailing 's' removed
      when 'fields', 'nameField'
        Builder = Field
      when 'picklistValues'
