couchbaselabs/mobile-travel-sample

Workshop code feedback (WORKSHOPSV_17)

tleyden opened this issue · 4 comments

I'm going through the workshop tutorial, putting some feedback here

Thanks! Can you tag each issue with "WORKSHOPSV_17" please. So you can include code and content related feedback. Also page link within each description would make it simpler

bookmarkHotels

http://docs-build.sc.couchbase.com:9000/develop/swift#/2/1/1

  • This function takes a list of hotels, and so it's doing a lot of looping within the function over that list. If a singular bookmarkHotel was refactored out of this, and bookmarkHotels was just a thin wrapper that looped over the list and called bookmarkHotel for each hotel, then it would put less cognitive load on someone trying to grok the code

  • Get the Ids of all hotels that need to be bookmarked

This could be changed from:

// Get the Ids of all hotels that need to be bookmarked
            let ids:[String] = hotels.map({ (dict)  in
                if let idVal = dict["id"] as? String {
                    return idVal
                }
                return ""
            })

to

let hotelIds:[String] = hotels.map({ (hotelDict)  in
     if let idVal = hotelDict["id"] as? String {
          return idVal
     }
     return ""
})
  • Rename document to bookmarkedHotelsDoc

I pushed up some changes to https://github.com/couchbaselabs/mobile-travel-sample/tree/connect_sv_tleyden_feedback, but just realized that the code samples in the docs would need to be updated to match these changes..

or @jamiltz do you have some slick javascript auto-docs-updater thing?

its all manually done at this point.