Natasha Murashev:
Instead of having that huge configure method, you can take out every part of it and put it into a SwitchWithTextCellProtocol
for that cell. That got me really excited. This way, I can have my view model conform to this protocol, and set all these properties right there. Now, I don’t have to have this huge configure method, but I still have a way to ensure that every single property is actually set.
[…]
With protocol extensions in Swift 2.0, you can do the same thing with default values. If there is a certain color that’s relevant for most cells, you can just extend it and set that color. Any view model that implements this doesn’t have to set the color anymore.
[…]
Instead of tying my protocols to the actual cell, I can tie it to a more generic TextPresentable
. This way, any view that has a label, not just cells, can conform to the text presentable protocol.
iOS Mac Model-View-ViewModel (MVVM) Programming Swift Programming Language
Hansen Hsu (via Andrew Wooster, comments):
During Jobs’ visit to PARC, he had been so enthralled by the surface details of the GUI that he completely missed the radical way it had been created with objects. The result was that programming graphical applications on the Macintosh would become much more difficult than doing so with Smalltalk. Said Jobs in his 1988 introduction of the NeXT Computer: “Macintosh was a revolution in making it easier for the end user. But the software developer paid the price… It is a bear to develop software… for the Macintosh… if you look at the time it takes to make [a GUI] application… the user interface takes 90% of the time.”
With the NeXT computer, Jobs planned to fix this exact shortcoming of the Macintosh. The PARC technologies missing from the Mac would become central features on the NeXT. NeXT computers, like other workstations, were designed to live in a permanently networked environment. Jobs called this “inter-personal computing,” though it was simply a renaming of what Xerox’s Thacker and Lampson called “personal distributed computing.” Likewise, dynamic object-oriented programming on the Smalltalk model provided the basis for all software development on NeXTSTEP.
[…]
By re-implementing Smalltalk’s ideas in C, Cox made it possible for Objective-C programmers to organize their program’s architecture using Smalltalk’s higher level abstractions while fine-tuning performance-critical code in procedural C, which meant that Objective-C programs could run just as fast as traditional C programs. Moreover, because they did not need to be installed alongside a Smalltalk virtual machine, their memory footprint was comparable to that of C programs, and, being fully native to the platform, would look and feel the same as all other applications on the system.
Wooster quotes a section on the development of NeXT’s additions to Objective-C: categories, protocols, forwarding, and more.
Previously: The Appsmiths.
Cocoa Compiler History Interface Builder iOS Mac NeXT NEXTSTEP Objective-C Programming Smalltalk Steve Jobs