iOS-updates-2018 / Labs

Lab Exercises for 67-442 Mobile Application Development in iOS at Carnegie Mellon University.
1 stars 1 forks source link

Temp Converter Updates #10

Closed kicohen closed 6 years ago

kicohen commented 6 years ago

Changes:

Future possible changes:

jestapinski commented 6 years ago

Hey Kenny thanks for this.

So one of the quirks of the cmuis.net markdown system is indentation matters for ordered instructions, meaning if the code used in instruction point 3 is not indented it screws up the formatting so the next number is not a 4 but a 1 (take a look at https://67442a.cmuis.net/labs/1 right now and sub in the indentation).

I agree on the private but I think we cover enums in a separate example? I'll look into this but for now please fix the indentation to what it was for code blocks for this reason.

kicohen commented 6 years ago

The thought on the second part is that it's really bizarre to take an input in a function that could be in any unit and convert it to another random unit. Like how can I be sure that the user didn't put a temperature in Kelvin in. It just seems like poorly written code and I get that its just a small example in a lab but I think that we should be giving good examples of software design in all the code we give out.

If I was writing this code in a real environment it would either have a separate class for temperatures where you initialize the temperature with a unit and then there is a convert method so that you can make sure that you are converting properly between units or there would be a bunch of static methods like TempConverter.converFtoC(tempInF: Float) -> Float and TemoConverter.convertCtoF(tempInC: Float) -> Float

jestapinski commented 6 years ago

Agreed, ok this works for me. I'll begin reviewing your labs in the next few days.

jestapinski commented 6 years ago

Hey I've been thinking about this and here is an idea. Week 1 we just want people to get their feet wet with Swift but in week 2 we can introduce a model skeleton (which we already do) with this refined signature, meaning we break convert into convertFtoC and convertCtoF and make a note this is how to do it.

In my mind, this helps improve learning potential by going back to have them also clean up old code. We did this at some points in 272 in the Spring and the anchoring was certainly helpful to students.