5 ms·
I've actually run into a couple of people with six-digit SO scores that profess to not know about such concepts as polymorphism. My jaw dropped. Maybe they wer
by ChrisMarshallNY 7y ago
I've actually run into a couple of people with six-digit SO scores that profess to not know about such concepts as polymorphism.
My jaw dropped. Maybe they were being a smartass, but that's just crazy talk.
Like all dogmatic stances, people just take a "My Way or the Wrong Way" approach.
Most of my engineering is a hybrid of classic (read: "old") techniques, and new, "cutting-edge" techniques.
I write about my outlook on that here: https://medium.com/chrismarshallny/concrete-galoshes-a5798a55af2a https://medium.com/chrismarshallny/concrete-galoshes-a5798a5...
(Scroll down to "It's Not An 'Either/Or' Choice").
One day, AIs might replace us poor coding schlubs. At that point, we can assume that everything will revert to Machine Code.
Until then, OO is a great way for humans to grok the complexity of software development.
I will always keep refering to this classic joke, when I encounter inflexible, dogmatic thinking: http://www.solipsys.co.uk/new/TheParableOfTheToaster.html http://www.solipsys.co.uk/new/TheParableOfTheToaster.html
- pinopinopino 7y agoA domain specialist writing software for embedded devices, perhaps has not a lot of use for polymorphism or functional programming. Not everyone needs to know everything, tat is ok.
- ChrisMarshallNY 7y agoTrue, dat (I believe that Linus is a rabid "straight C" man). However, these were people answering Swift questions. Swift introduces "Protocol-Oriented Programming" as dogma, which has some really salient points, but is not the Philosopher's Stone of software development. EDIT: Added "as dogma"
- mpweiher 7y agoWell, for one it's not actually new. Protocols are interfaces, sets of messages. Hmm...that would be message-oriented programming, which is what Smalltalk for example has been all about. First equating OO with heavy use of static typing and inheritance (which wasn't the idea), noting that that doesn't actually work (surprise!) and then "inventing" POP...sigh. https://blog.metaobject.com/2015/06/protocol-oriented-programming-is-object.html https://blog.metaobject.com/2015/06/protocol-oriented-progra...
- zozbot234 7y agoNo, Smalltalk does not have "protocols", traits or interfaces. Everything is dynamically typed ala Objective C.
- mpweiher 7y agoLast sentence first: Objective-C certainly has (optional) static types and protocols[1][2], or as Java calls them, interfaces. In fact Java interfaces were "borrowed" from Objective-C[3]. In fact, Objective-C needs the types of a message's arguments and return value in order to generate correct code in the general case, and since message names can be ambiguous it needs to know the static type of the receiver (or "close enough") in order to know those static types in the message. If all arguments and the return value are objects, then this is not necessary, this "id subset" has some nice properties.[4] In Smalltalk, the messages an object responds to are called its protocol.[5] "Every object in Smalltalk, even a lowly integer, has a set of messages, a protocol, that defines the explicit communication to which that object can respond." Now that that single protocol for the entire object can be split into multiple meaningful protocols should be obvious, but Alan Kay has also explicitly talked about objects embodying "multiple algebras"[6] The basic idea of "protocol oriented programming" is that you focus on what an object can do (its interface/protocol) rather than what it is (its class/type) and that Smalltalk certainly did. Whether you check this statically is a secondary and certainly orthogonal concern, but of course there were and are statically typed variants of Smalltalk (such as Strongtal) and type-systems for others Smalltalks. Traits were introduced in 2003 for Squeak Smalltalk.[7] [1] https://en.wikipedia.org/wiki/Objective-C#Protocols https://en.wikipedia.org/wiki/Objective-C#Protocols [2] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithProtocols/WorkingwithProtocols.html#//apple_ref/doc/uid/TP40011210-CH11-SW2 https://developer.apple.com/library/archive/documentation/Co... [3] https://cs.gmu.edu/~sean/stuff/java-objc.html https://cs.gmu.edu/~sean/stuff/java-objc.html [4] https://blog.metaobject.com/2014/05/the-spidy-subset-or-avoiding-copeland.html https://blog.metaobject.com/2014/05/the-spidy-subset-or-avoi... [5] https://www.cs.virginia.edu/~evans/cs655/readings/smalltalk.html https://www.cs.virginia.edu/~evans/cs655/readings/smalltalk.... [6] http://www.cs.uni.edu/~wallingf/blog/archives/monthly/2014-06.html http://www.cs.uni.edu/~wallingf/blog/archives/monthly/2014-0... [7] http://scg.unibe.ch/archive/papers/Scha03aTraits.pdf http://scg.unibe.ch/archive/papers/Scha03aTraits.pdf
- wool_gather 7y agoSwift did not introduce "Protocol-Oriented Programming". As misinterpreted and broadly applied, it's been present in (among others) Java and Objective-C forever. As actually intended (listen to Dave Abrahams clarify what he meant on John Sundell's recent podcast) it has much more to do with parametric types and functions that operate on them, and is almost directly inherited from ideas that have been in C++ since the STL.
- mpweiher 7y agoNot aimed at you, but... Misinterpreted? Sorry, but the definition of a protocol, particular in the context of Swift/Objective-C has been fixed for around a quarter of a century. And of course, those protocols were what he talked about in his presentation. If he meant something different, possibly he should have (a) picked a different term and (b) talked about something else at WWDC.
- wool_gather 7y agoGood points; I can't really disagree.
- ChrisMarshallNY 7y agoYou guys are both right, but I should have rephrased that "introduces as dogma." I get a bit discouraged, when smart, energetic engineers (usually young), latch onto the buzzwürd du jour, and declare it to be "The One, True, Path; all heathens and apostates must be cleansed with fire." I say that, as having done exactly that, myself. Looking back at my thinking, then, makes me wince.
- falcolas 7y ago> I've actually run into a couple of people with six-digit SO scores that profess to not know about such concepts as polymorphism. Perhaps this is just a symptom of "measure some aspect of a person's output, and that person will optimize for that measurement, no matter the cost to the rest of their output." > Until then, OO is a great way for humans to grok the complexity of software development. Particularly in domains where everything is an object, like game development.
- cardiffspaceman 7y agoBut in game development it seems many have been converted to ECS.
- ChrisMarshallNY 7y agoIsn't ECS just a specialization of OO? I thought it was an aggregation (as opposed to hierarchical) model. I've been doing that with OO for decades. It makes a great deal of sense, in some cases. PoP has similarities to that, but, in my experience, there is absolutely nothing that can compete with polymorphism and/or inheritance -and, here's the kicker- in some situations. OO, in my experience, is a lot different from just polymorphism. I think that it's a way of conceptualizing the model. I used to write OO in straight C, in the late 1980s. I called it my "Faux Object" pattern. It even had a rudimentary form of polymorphism (no vTables - just function pointers that could be replaced -Poor man's vTable). My experience is that lots of people have difficulty adapting to hybrid design. We learn one tool, and we learn it well. We go to conferences, where we are told that we are über-programmers, because we use this tool. But try using a screwdriver to drive a nail. Most of my friends that are (building and construction) contractors are quite used to hybrid design. They use one technique and set of tools on the foundation, another on the walls, and yet another on the roof. Some of these aspects are a large enough field that they can specialize (like framers or roofers), but there are quite a few "general" contractors that are capable of building a house from scratch. I started off with Machine Language (the original "ML"), and have written device interface code for a long time, and am quite used to a lot of limitations (like "lite" versions of languages for lower-layer work or embedded content). We use the best tools for the task at hand, and don't sneer at others that don't use them.
- barrkel 7y agoI'd say all programmers of any significant experience know the concept of polymorphism, but it's quite possible to know the concept without knowing the word. They might be using discriminated unions, or type-distinguishing enums on rows or structs with a superset of attributes, but the concept is hard to avoid when trying to generalize behaviour over heterogeneous data.
- pinopinopino 7y agoGood point, you see this so often in C code bases. Didn't even think about that.