I'm an intermediate developer trying to learn more about software design patterns. I've read most of the questions and answers on StackOverflow asking the same type of question. Most of the answers recommend reading Head First or learn by yourself / write code and you'll figure out it approaches.
So I've read Head First and Java Design Pattern Essentials. I've learned a lot... about how to design apps that simulate ducks and automobile factories.
Are there any books and code examples that explain practical ways of using design patterns? For example, I am an Android developer, and I found the MVP example and explanation extremely useful:
Are there any other examples like this for the more common design patterns like Strategy, Factory, Observer, Adapter? I think it's great to learn why / how design patterns work, but as a beginner and without real examples I'm not sure when to use them. For example, I've been trying to find a way to use Singletons. But there are no real Java / Android examples using them.
I've found examples of ac actual Singleton class, but no implementation of using them in real world cases. I read that they are very useful for Logging. So I spent an hour trying to figure out why I would use a Singleton to Log messages instead of just writing a class that extends the default Log class. I couldn't figure out any advantages of using a Singleton.
In particular, most of the apps I've written in the last few years have been Android GUI apps that get and deserialize JSON data from a server... save the data to storage... display the data to the user... and push new data to the server.
I know this question has been asked a bunch of times, but this question author would like to know if there are any practical code examples / books / courses that could show me real world examples of a Singleton, Strategy, Observer, Adapter of an Android app that pushes / pulls / displays data from a cloud server. Not sure how this would be off-topic, it's a pretty specific programming/design question.
Thanks!
Aucun commentaire:
Enregistrer un commentaire