[Draft]iOS.Architecture.16.Truth

阅读: 评论:0

[Draft]iOS.Architecture.16.Truth

[Draft]iOS.Architecture.16.Truth

Concept: Truth, Information Flow, Clear Responsibilities and Immutability

 

1. Truth

 

1.1 Single Source of Truth

单一的事实/真想来源

Ref[2] Ref[3]

 

"One core principle that is good to keep in mind when modelling various states is to try to stick to

“single source of truth” as much as possible. One easy wayto look at this is that you should never

need to check for multiple conditions to determine what state you are in." Ref[2]

 

1.2 Truth vs 

Ref[1] 

 

2. Information Flow (Data Flow)

 

 

 

3. Clear Responsibilities

 

 

4. Immutability

google "immutable object in objective-c"

 

4.0 Mutable vs Immutable Object 

 

 

4.1 Why immutable object?

 

Value Object

“In computer science, a value object is a small object that represents a simple entity

whose equality is not based on identity: i.e. two value objects are equal when they

have the same value, not necessarily being the same object.

 

Value objects should be immutable: this is required for the implicit contract that

two value objects created equal, should remain equal. It is also useful for value objects

to be immutable, as client code cannot put the value object in an invalid state or

introduce buggy behaviour after instantiation.” Ref[9]

 

Value Object and Mantle

"For an Objective-C class to be used as a value object, it needs to be immutable,

support value equality, implement proper hashing, and support NSCopying.

Mantle provides the latter three just by subclassing MTLModel. "

 

4.2 Immutability and Builder Pattern

Ref[4] Ref[5] Ref[8]

Too many parameters in initializer method

 

4.3 Builder Pattern in Objective-C and Swift

Objective-C Version

.html 

Swift Version

Todo

 

4.4 Code Generation (DSL, ruby)

Ref[10] 

 

4.5 Code Generation (remodel) 

Ref[11] Ref[12] 

 

Remodel Plugin

.md 

4.6 Code Generation (plank)

Ref[13]

 

4.7 Consistency

Ref[14]

 

 


Reference

1. Advanced iOS Application Architecture and Patterns

2. Modelling state in Swift

/@johnsundell/modelling-state-in-swift-3751a4acb8f3

Rules: 

A single source of truth

Making states exclusive

Rendering reactively

Handling state changes

Extracting information

 

3. Single source of truth

4. Immutability and Builder Pattern

  • objc.io: Value Objects
  • Wikipedia: Builder Pattern
  • Wikipedia: Immutable Objects
  • Concepts in Objective-C Programming: Object Mutability

5. Value Objects (Read Again)

/

6. Mutability, aliasing, and the caches you didn't know you had

 

7. Boundaries (To Read)

8. Improving Immutable Object Initialization in Objective-C

/

AHKBuilder

9. Simplifying Objective-C Value Objects with Mantle and the Builder Pattern (AAAA+)

/

10. Objective-C Value Objects: Code Generation

/

11. Building and managing iOS model objects with Remodel

/

12. remodel

Remodel is a tool that helps iOS and OS X developers avoid repetitive code by generating Objective-C

models that support coding, value comparison, and immutability.

13. plank

A tool for generating immutable model objects /

/

14. ConsistencyManager-iOS

A library that manages consistency of immutable models …

15. iOS响应式架构

/

16. Single Source of Truth Principal in Software Development (Android) 

=Ex9IT1bq0PQ

codingwithmitch/courses/android-local-database-cache-rest-api/demo/

In this course you'll learn how to build a local database cache with SQLite and Room.

The cache retrieves data from a REST API using Retrofit2. Architecture is MVVM.

17. Difference between Single Source Of Truth and Single Responsibility Principle?

18. Understanding One Source of Truth for Analytics

/

19. The Single Source of Truth

20. Why Single Source of Truth Data Systems Kill Team Collaboration

/

21. Single Source of Truth

22. Single Source of Truth…and Why it Matters

/@elisavaccaro/single-source-of-truth-and-why-it-matters-a68e28b8c175

23. 应用架构指南

 

 

转载于:.html

本文发布于:2024-01-27 17:53:28,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/17063492081753.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:iOS   Draft   Architecture   Truth
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23