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

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:

主站蜘蛛池模板: 宜宾市| 滦平县| 重庆市| 扎兰屯市| 大埔区| 从江县| 广水市| 叙永县| 华亭县| 云和县| 兴化市| 镇安县| 城步| 龙游县| 麟游县| 通化市| 西和县| 张家川| 辽中县| 宜昌市| 雷波县| 通道| 县级市| 淮滨县| 常山县| 博客| 民勤县| 金沙县| 丰宁| 尼木县| 五河县| 梁河县| 漠河县| 镇雄县| 田东县| 大新县| 乐陵市| 满城县| 工布江达县| 布拖县| 阿拉善左旗|