1

I am an aspiring iOS developer with not much experience except 3 months of courses on threehouse.

I decided to make an app (just for fun) that counts the calories within your salad.

I have constructed a very rough model which uses a class Vegetable and I inherit different classes for each vegetable, however this is clearly wrong and I could see it from the first 10 minutes. Now I am wondering if my approach wouldn't be better with just using a Struct named Produse and instantiate from there every ingredient since most of the ingredients in the salad are the same and I am only interested in the properties name: String, type:ProduceType (an enum), caloriesPerHundredGrams: Double. All of these member values are essentially the same for fruits, vegetables and spices.

Any suggestions?

P.S. I don't know how to retrieve data from the web yet and I intend for this exercise to have all of my ingredients hardcoded. I will use a server as a backend once I learn that!

Ajit Medhekar
  • 1,018
  • 1
  • 10
  • 39
Sebastian Nitu
  • 117
  • 1
  • 7
  • 3
    Possible duplicate of [Why Choose Struct Over Class?](http://stackoverflow.com/questions/24232799/why-choose-struct-over-class) – 4oby Aug 19 '16 at 08:21

0 Answers0