官术网_书友最值得收藏!

Design patterns

There is no need to reinvent the wheel and there is no need for us to repeat ourselves. This is exactly what the Don't Repeat Yourself (DRY) software development principle dictates. A design pattern is a solution for a common problem, and such a pattern can be used in many places across your app. It is the methodology that we can trust, which will help us to speed up the development process. Patterns could help us develop high-quality software with minimal effort. They also can help us deal with the separation of concerns. Some well-known patterns are the Model View Controller (MVC) pattern, the somewhat similar Model View Presenter (MVP), and the Model-View-ViewModel (MVVM) approach.

There are some great books about design patterns and it is beyond the scope of this book to have a detailed look at all of them, but the MVC/MVP is of particular interest because it is used the most for mobile development. The idea behind the pattern is to separate the UI from the business logic and data from the logic. When you have a closer look on the structure of most Android or iOS apps in Android Studio or in Xcode, you will notice some parts of this pattern already. A controller gets data from another layer. This layer can be a client or a repository class. For example, it will get its data from an API or from a local source. The controller communicates the obtained data through a model (or view model) to the user interface:

主站蜘蛛池模板: 婺源县| 通山县| 南丹县| 华蓥市| 双流县| 兰考县| 互助| 新龙县| 扬中市| 普洱| 滁州市| 浑源县| 茶陵县| 高陵县| 松阳县| 开平市| 扎鲁特旗| 晋州市| 凉城县| 武隆县| 专栏| 溧水县| 宜州市| 射洪县| 色达县| 贵阳市| 北碚区| 南华县| 汉阴县| 镇雄县| 高陵县| 都匀市| 锡林浩特市| 河北省| 闻喜县| 六安市| 砀山县| 伊通| 玛多县| 定安县| 宣城市|