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

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:

主站蜘蛛池模板: 平湖市| 扬中市| 葵青区| 秦皇岛市| 门源| 泾川县| 宜春市| 叶城县| 武穴市| 广平县| 连云港市| 宁南县| 湘西| 工布江达县| 永吉县| 盐亭县| 平罗县| 伊春市| 荆州市| 柯坪县| 兴和县| 理塘县| 镇安县| 杂多县| 峨山| 明溪县| 贵港市| 萍乡市| 文山县| 社旗县| 岳池县| 武强县| 鸡东县| 毕节市| 舒城县| 乐平市| 土默特左旗| 太仆寺旗| 赣榆县| 白城市| 马公市|