Presentation is loading. Please wait.

Presentation is loading. Please wait.

Issues of visibility and number of classes. I have shown several different ways In the counter example I used Reyer’s code with lots of classes In handout.

Similar presentations


Presentation on theme: "Issues of visibility and number of classes. I have shown several different ways In the counter example I used Reyer’s code with lots of classes In handout."— Presentation transcript:

1 Issues of visibility and number of classes

2 I have shown several different ways In the counter example I used Reyer’s code with lots of classes In handout ? I put everything in one class In this directory we have a sort of ‘half-way’ approach In some examples there are inner classes as well WHY SO MANY WAYS OF DOING THINGS?????

3 BECAUSE THAT IS LIFE! We are balancing elegance and simplicity You will have to do that too But there are a few implications of the different methods

4 One rule of thumb MVC – Model View Controller visibility Model Underlying data View Way things display Controller How to control

5 If you use lots of classes That is nice because it separates concerns …but ….. If you have a separate listener object it will need to be able to see the Model so that it can make changes, and then it may need to see the View to display them That’s fine – just link the objects as you see fit (don’t be afraid of it) we will do more on this later

6 So, trying to give you lots of ways That way you have more to choose from If you are finding it confusing, look at the handout ? In which I do everything in one class. If you understand that then you can then split the class up as an exercise and make yourself more comfortable gradually

7 Inner classes If you look back at the code for the first couple of examples, you’ll see inner classes there Some people don’t like them (and obviously they don’t help split the coding task up between people) but they do separate concerns while still making visibility possible

8 The only way to get better with this Is to try from scratch yourself And then come to terms with your difficulties Look at the problem described in TopiczzConsolidationExercise


Download ppt "Issues of visibility and number of classes. I have shown several different ways In the counter example I used Reyer’s code with lots of classes In handout."

Similar presentations


Ads by Google