Skip to main content

Posts

Showing posts from December, 2019

Swift by Sundell

Re note some refactoring techniques and concepts Bad Smells in code: Duplicate, long method, large class, long parameter list, divergent change (?), shotgun surgery Feature envy, Data clumps, lazy class, middle man, message chains, ... Techniques: Composing methods, Moving features between objects Organizing data Simplifying conditional expressions Making method calls simpler Dealing with generalization Some interesting material from Sundell for some ideas, technique on what is bad code and how to refactor it. Lightweight API design in Swift https://www.swiftbysundell.com/articles/lightweight-api-design-in-swift/     Often when we design how our various types and functions will interact with each other, we have to find some form of balance between power and ease of use. Make things too simple, and they might not be flexible enough to enable our features to continuously evolve — but on the other hand, too much complexity often leads to frustration, misund...

Swift optimize compiling time

Compiling development have pain in the ass issues: compiling time. With many mainly Script developer like me, we familiar with edit => refresh => testing => done. But with compiling language like iOS Swift or Android Java/Kotlin, even single bit of change to source code require rebuild (In my knowledge). And it make newbie more stress, panic since you are new and have to make small change step by step to trial and error to see what take effect... I mean newbie have to make more build Time compiling >=2 minutes (120s)  Slowest ~5 minutes - ~500 file source => 50-75s compile - assets ~500files ~7s - XIB some take huge time to compile (15-23s); randomly slow each build ie. TagUser..xib some time slow, so it hard to know exactly which xib slow. - The more file, module included, the more tangled, required messing, So it hard to comment out/ exclude one file. And then total compile time spike up. 1. Almost all Pods libraries already removed: - Twitter - Facebo...