23 ms·
It's not what programming languages do, it's what they shepherd you to
- fatso784 7y agoPaul Dourish reviews some work on this topic in his book Stuff of Bits, see pages 8-9: https://mitpress.mit.edu/books/stuff-bits https://mitpress.mit.edu/books/stuff-bits It's related to, but definitely not the same as, linguistic relativism. Programming "language" might be a bit of a misnomer, because it creates a false equivalency to natural language. Just as different subfields of mathematics were created to solve different problems, so too were different programming "languages" inspired by different subfields and their notations. With that view, it's unsurprising that some ways of doing things highlight certain methods of solving problems and obscure or impede others.
- oyebenny 7y agoFacts.
- JoeAltmaier 7y agoIf all you have is a hammer, everything looks like a nail.
- lsh 7y agoMy favourite when working in teams is: "use the right tool for the right job", which presupposes you know many tools and have experience working with them ... and that the shared set of tool knowledge in the team is more than just a hammer and a nail.
- muglug 7y agoThis also can change over time. For example, 15 years ago PHP shepherded you to include every file you were using explicitly, making it hard to reason about a given project if you weren’t the creator. A big effort ensued to change that — class autoloading became the standard, and a large community arose around that standard. Similarly, JavaScript shepherded you towards some bad practices that the community has now found ample remedies for.
- pitterpatter 7y ago> This also can change over time. For example, 15 years ago PHP shepherded you to include every file you were using explicitly, making it hard to reason about a given project if you weren’t the creator. Huh, that seems backwards to me? Wouldn't the explicit approach make it more obvious what scripts were relevant?
- toast0 7y agoThat's been my experience; in the before times, I could step in and look at a server with issues and easily find the source (as long as nobody was too clever about paths), with autoloading I just have to grep the whole thing and hope. I don't like a lot of what 'Modern PHP' has become though, so clearly the community is going a different direction without me, and I guess it's working for them.
- earthboundkid 7y agoYes, modern PHP is different and better than the PHP everyone cranked out in the 00s, but auto-importing is orthogonal to the improvements. The big change is to use classes everywhere.
- muglug 7y agoUsing classes everywhere was made much easier with the auto-importing. In fact the auto-importing means that regular functions (which have no auto-importing mechanism) are now used less than they probably should be.
- muglug 7y agoOftentimes not, because you'd end up importing everything as a precautionary measure, and there was a big temptation to mix together many classes and functions in the same file.
- arthens 7y agoAs someone who has written a lot of PHP and is still maintaining a few PHP codebases... I don't miss the old ways at all. But I can see how the parent comment can be misleading for someone who's not too familiar with PHP (apologies if my assumption is wrong). TL;DR in many ways modern PHP is more explicit than old PHP The old way wasn't as explicit as the comment makes it. It was just painful. Imports in PHP are global, so every file can use any function/class already imported. You could explicitly define all dependencies at the top, but that's not what the language shepherds you to. In reality most imports were implicit (explicit in ANOTHER file), and you'd just import what you needed that hadn't been already imported (I don't think I've ever worked in a codebase where every file has all dependencies declared at the top). The old ways had so many downsides: - moving things around could produce fatal errors just because the implicit imports changed - any framework/cms using require instead of requice_once would limit your ability to import files (including the same class twice creates a fatal error) - very poor support for IDEs The modern way is quite pleasant to work with: - everything should be in a namespace - every used class should be declared at the top of the file (like Java) - great IDE support (auto imports, auto complete, click to go to definition) Yes there's some extra complexity in the autoloader, but in my experience it's negligible. If you use an IDE you might never even see it. So yeah I don't think PHP got any less explicit. The opposite actually, modern libraries/frameworks tend to be much easier to navigate.
- elevenoh 7y ago"shepherding: An invisible property of a programming language and its ecosystem that drives people into solving problems in ways that are natural for the programming language itself rather than ways that are considered "better" in some sense" Seems like most could lend a little more weight to: 'does this lang align with how do you want to think about/represent the problems you're solving'
- hinkley 7y agoThe corollary for language and API designers: whatever you make easiest is what people will do. If there is a 'right' way to do something, make that the default or the simplest calling pattern. If there is a new 'right' way, don't route the new way directly through the old way. People will think they're cutting out the middleman by keeping the old calling convention as long as possible.
- anko 7y agoI totally agree. I'd also like to add that a lot of the time in open source, it's as simple as having the examples be full examples with the error handling needed to use it in a production system. Quite often the examples shown are the "simple" ones, but they leave a lot out. I wish it weren't the case but those are often also pasted into production code.
- toast0 7y ago> If there is a new 'right' way, don't route the new way directly through the old way. People will think they're cutting out the middleman by keeping the old calling convention as long as possible. It's best if the old way becomes a shim onto the new way --- that shows that the new way works, and encourages moving to the new way -- nobody wants to keep a shim they don't need, and if the new way can do everything, the compatability shim isn't needed.
- eyegor 7y agoI agree with all the points brought up in this article except for this curveball: > Turing complete configuration languages shepherd you into writing complex logic with them Everything discussed in this post is a consequence of language design or best practices. I don't think shoving complex logic into yaml files would be considered either. This is more a possibility as a result of Turing completeness, I don't think the language design has anything to do with it. All the other "shepherding" examples are clearly intentional choices by the language designers.
- taeric 7y agoIt is a funny choice of examples. I configure Emacs with script. And, while I certainly have some bitrot in my config, it is still way more manageable than any other config I have had to deal with.
- SkyMarshal 7y agoFwiw, Emacs is usually single-user, and self-selects users better able to understand and manage their own complexity.
- taeric 7y agoI view it as yet another thing I have to maintain. Show some frugality in how you do it. And recognize it is a yak.
- jdfellow 7y agoI think that the author of the article specifically speaking of configuration DSLs that were intended to be Turing-incomplete but somehow grew full Turing-completeness and therefore became bastard languages. YAML as a config DSL is sub-par (but I'll take it over JSON any day), and truly declarative, Turing-incomplete config languages are great, as is just using a fully-featured scripting language such as a Lisp or Python, but the middle-ground with a custom config language that is also Turing-complete is usually just bad. Not sure I have any examples of what that might be. Perhaps nginx? or apache? Lots of complex software have very complex config languages that might accidentally be Turing-complete, but only fools would actually use them like that.
- black_thoughts 7y agoI would have liked to have seen more examples of what different languages shepherd you to do. Python, in my experience, shepherds you to import a lot of modules rather than writing your own. There's so many helpful ones available and that's kind of a reality shock if you switch to some other languages.
- zzo38computer 7y agoI believe these things, and is why I think different programming languages are good for different purposes and are why I use different programming languages rather than only one kind. (For example, Haskell isn't a programming language I use much although I do use it sometimes because sometimes what I make is what it seems like good for to me.)
- DubiousPusher 7y agoThis is my main issue with C++. For a while my job was to get game engine codebases running, integrate tools and move on. So I saw a lot of big C++ codebases. Nearly every one had the same bad behaviors. Tons of globals. Configuring build options from code. Header mazes that made it clear people didn't actually know what code their classes needed. I then worked for awhile developing a fairly fresh C++ code base. The programers I worked with were very willing to write maintainable code and follow a standard and it was still really damn hard to keep things like header hygene. When I go back to the language I can't believe how much time I spend dealing with minor issues that stem from the bad habits it builds. For years I would refuse to say any language was good or bad. Always I insisted you use the right tool for the job. And there are some features of C++ that when you need them you have to use that language or maybe C in its place. But the shortcomings are unrelated to language's issues which largely seem to come from a focus on backward comparability. And so even used in its right application it seems incredibly flawed. And I pretty much believe it's a bad language now. Disclaimer: I learned to program with C++, I understand its power and for years I loved the language. I also understand there are situations where despite its shortcomings it is the right choice.
- naikrovek 7y agoWhy are globals considered bad? I'm seriously asking. I, too, have been told hundreds of times over the course of my career, and I never questioned it. I want to question it now, because I've never understood why people work SO HARD to remove and avoid globals. I seriously doubt that the time and effort I've seen spent on removing and avoiding globals has been time well spent. And I'm quite sure that the effort spent on that is not comparable to the amount of problems prevented by not having globals. There's just no way globals can be dangerous enough to justify the size of globals-cleansing efforts I've seen. Game development often has a very large global state, and game problems are often inherently global state manipulation problems; you need globals in order to even have the game in many cases.
- ionforce 7y agoA loss of local reasoning. You don't know which functions will touch the variable and when. You might know at a high level on paper, but you won't have clean, easy-to-read and easy-to-predict life times. Then you'll have race conditions.
- fileyfood500 7y agoWorking in a Java/Kotlin environment, everyone always handles all null cases when working in Kotlin, but they are frequently overlooked in the Java applications. Many of the Java apps compensate with more levels of catch-all exception handlers targetting unexpected NPEs. The only time we get NPEs in Kotlin is when Kotlin allows them because of the Kotlin/Java interop problem. Working with Javascript/Typescript, we need to rely on linters to enforce safe practices in Javascript.
- okareaman 7y agoJavaScript shepards you into monkey patching
- dlbucci 7y agoShimming and polyfilling (i.e. ensuring standard functions are present and what not) sure. But I think most codebases avoid monkey patching (i.e. adding new functionality to built ins). Maybe it's up for debate if the language itself guides people in that direction, but no one seems to do it anymore, so I personally don't think it does.
- _bxg1 7y agoThe new culture around modules actively shepherds people away from monkey-patching. Whether or not Webpack is considered "part of the language" for these purposes is fairly academic, but yes, the reality is that people don't really do that any more.
- djyde 7y agoYou read the code. The computer program you.
- collyw 7y agoThere is probably more truth in this than people realise at first glance.
- btilly 7y agoIt is the language plus the community. And not just the language. As an example, there is nothing about Ruby that makes it more or less prone to monkey-patching than many other dynamic languages. But once a certain number of popular frameworks did that, there was no getting away from that. (Rails even has a convention around where you put your monkey patches.)
- deleted 7y ago[deleted]
- joelbluminator 7y agoYou're talking about ActiveSupport probably, and I really love it. It augments Ruby in a very beautiful way. I really like 2.days.ago There were zero times were I wished it wouldn't do that. But to each his own.
- pas 7y agoSupporting postfix operators, extension methods, etc. is different from monkey patching. Scala has "2 days ago" conversion to Duration type via implicits, but it doesn't monkey patches Integer for that. C# has extension methods and it can do the same without monkey patching. And monkey patching is not necessarily the end of the world, it's just error prone if multiple libs try to do it (on the same targets) without being careful.
- joelbluminator 7y agoNever said you can't reach the same outcome with other languages. I guess C# can do DateTime.Today.AddDays(-3). It's all turing complete, so yes, you can do it in assembly as well. I just really love Ruby's (Rails actually) 2.days.ago and never saw the harm in that. It's readable, easy and nice.
- sethammons 7y agoReadable yes. I don't feel it is writable. Discovery only happens when you read what someone else did or you guess unless you read over the entire docs related to $thing. It is a major reason I dislike Ruby as these things are encouraged. In testing, it is even worse. Made up DSL: Expect(myFunc).WithParams(4).To().BeCalled(1).Returns(8).InUnder(2). Milliseconds().WithEspilon(30).Microseconds(). You have to be fully familiar with a custom DSL to write this kind of test. I prefer Go's principal of "tests are just code." It is more verbose to write, but no custom DSL to learn. The more verbose code is often not harder to read either as it is the same code style as the application too.
- mickduprez 7y agoBe the shepherd, use Lisp :D Seriously though, what other languages other than Lisp (all the mainstream ones at least) give you the freedom to change the language and/or create DSL's with the same ease? And you can still do your 'bare metal' in C if you really really need to and bring it in.
- _bxg1 7y agoI actually think the OP perfectly explains the core problem with Lisp: Part of the value of shepherding is getting everyone on the same page. When everyone's their own shepherd, nobody is on the same page.
- Fellshard 7y agoJavascript is this on steroids: It wants to be inspired by Lisp, by Self, by Java, and the resulting melange smells like every paradigm while fitting none of them. Trying to write applications in Javascript is trying to corral the minds of hundreds of people who each had a different idea of what Javascript is and what it does and what it wants you to do. The resulting system is doomed to total incoherence.
- _bxg1 7y agoJavaScript started out as a sort of "Java-flavored Scheme", actually However, I'd say that modern JavaScript - the language - is much more like C++ than Lisp. It isn't a void of shepherding, so much as shepherding-by-committee. However, due to how easy its ecosystem has made package management (in contrast with C++), much of that quagmire has been papered over with much more strongly-opinionated (shepherding) frameworks and dialects. This hasn't completely solved the "C++ problem", but it's gone a long way towards mitigating it. Working in modern JavaScript may be wildly different between frameworks, but it's reasonably consistent between projects that use the same frameworks.
- DeathArrow 7y agoIn other programming languages there is a consistency between frameworks and a default way to do things: there's no shitload of frameworks each reinventing the same wheel. Some things are easy doable without frameworks. In Javascript land you don't learn the language, you learn frameworks. And, some "JS frameworks" like Angular do not even promote JS, due to how terrible the language is. If your current framework goes out of fashion in favor of the next shiny thing, you are out of luck. I am unfortunate enough to having had to learn one of JS frameworks because our web apps are APIs in the backend and I have to do the frontend too and people who started the projects were fans of a particular JS framework. For upcoming projects I'll use Blazor after it becomes production ready, no more JS frameworks for me. I don't dislike JS, I quite enjoyed old-school ES6 + jquery. I even like Vue because is very customizable. I have a strong dislike for big opinionated frameworks like Angular.
- l0b0 7y agoThat's a great metaphor for language smells! Some more anecdotes: - Python shepherds you into using list comprehensions, even when it's almost always premature optimization and much harder to read than a loop. As a language smell that's not bad, it's just the worst I could think of in a post-v2 world. Luckily there's `black`, `flake8`, `isort` and `mypy`. - Bash shepherds you into using `ls` and backticks, useless `cat`s, treating all text as ASCII, and premature portability in the form of "POSIX-ish". Luckily `shellcheck` takes care of several common issues. - Lisp shepherds you into building your own language. There's also tool shepherding: - IDEA shepherds you into refactoring all the time, since it's the only IDE which does this anywhere near reliably enough. (At least in Java. In other languages renaming something with a common name is almost guaranteed to also rename unrelated stuff.) - Firefox shepherds you into using privacy extensions. - Chrome shepherds you into using Google extensions. - Android shepherds you into installing shedloads of apps you hardly ever use. - *nixes other than Mac OS shepherd you into using the shell and distrusting software by default. - Windows and Mac OS shepherd you into using GUIs for everything and trusting software by default.
- lsh 7y ago> - Android shepherds you into installing shedloads of apps you hardly ever use. I disagree with you on this one but I could be in the minority. I have about 8 apps that I trust and that rarely change. I don't go looking for new apps to install and I resist attempts to use the app version of a website. > Lisp shepherds you into building your own language I see the propensity of developers to build DSLs in all languages. I think the act of programming shepards us into creating elaborate abstractions.
- wodenokoto 7y ago> and I resist attempts to use the app version of a website. If you weren't being shepherded into installing apps, why are you resisting? I could install apps on my old Nokia dumb phone, but I never resisted installing apps. It never really seemed like it was worth the trouble to install one. I actually looked into it once, despite the system shepherding me away from installing apps.
- 7y ago
- gameswithgo 7y agoSomething i like about rust is it shepards you to fast running programs and away from null pointer errors. something i like about go is it shepards you to write code any other go programmer can follow easily something i dislike about c# is it has the tools to let you write very very fast code but shepards you to use non devirtualized interfaces over heap allocated classes tied together with linq overhead.
- elamje 7y agoI spend a fair amount of time in C# and don’t think about performance a lot unless it’s obvious, O(N^2) type of stuff. I’m always trying to level up so I would appreciate some tips. What tooling are you referring to that will make C# really fast? Also, what are you referring to with non-devirtualized interfaces vs heap classes with LINQ?
- DeathArrow 7y agoHe talks mainly about stack vs heap allocation. Stackalloc, pointers and such.
- will_pseudonym 7y agoWhat's the best way to get started becoming a C# developer? What kinds of C# programmers are there? I know fullstack web stuff and some Python, but no idea where to start with more proper languages.
- jiggawatts 7y agoThere's a crazy amount of high quality guidance out there, a mere Google away. It's a popular language! Step one: Visual Studio Community Edition is free. Go install it. Don't waste time with Visual Studio Code, it's a toy compared to the proper VS. When I learn a language, I like to start with the basic primitives: functions, loops, variables, etc... Then, explore the types and the standard library. Note that the .NET Framework has a fantastically huge base library, way bigger than other languages with the exception of Java. It's already a bit of a task just to flip through the list of available classes let alone functions! Do programming challenges like Advent of Code. Start poking away at Real Problems. Go from there...
- _bxg1 7y agoThis is a very good take. I've had a whiff of this idea for a while now, but never fully-formed it. As the author says, it's something that's been missing in lots and lots of language and framework debates and has caused people to talk past each other over and over. It's also a very helpful tool when examining why the cultures around certain technologies are the way they are.
- LoveMortuus 7y agoIs shepherding present in every aspect of life? My guess would be that it is and that shepherding is what we talk about when we say that we can learn from every aspect of life. If what I wrote is correct, than shepherding is the teacher of reality. But I guess it's on us to decide when we've learned enough and move on. I was at first wanting to ask if shepherding is present in video games as well, but then I realized what shepherding could actually be. SHEPHERDING; The part of an aspect that _can_ teach you something. _can_, because it's up to you to decide if you'll learn anything. Is shepherding always negative or can it be positive? Also, if we would always strive to fix what shepherding teaches us, would that mean that in infinite amount of time we would reach perfection? And, last question I swear, is shepherding subjective or objective. Or is it both?
- Sammi 7y agohttps://en.wikipedia.org/wiki/Nudge_theory https://en.wikipedia.org/wiki/Nudge_theory "Nudge is a concept in behavioral science, political theory and behavioral economics which proposes positive reinforcement and indirect suggestions as ways to influence the behavior and decision making of groups or individuals. Nudging contrasts with other ways to achieve compliance, such as education, legislation or enforcement. " "A nudge makes it more likely that an individual will make a particular choice, or behave in a particular way, by altering the environment so that automatic cognitive processes are triggered to favour the desired outcome."
- m12k 7y agoShepherding is when some behavior is encouraged by being made easy/rewarded, or by other behavior being made harder/punished. So shepherding absolutely happens in every aspect of life - systems move toward low energy states, water flows downhill and living creatures tend to follow the path of least resistance. When parents do it, we call it parenting. When governments or companies do it (via taxes/subsidies or pricing), we call it nudging. When groups do it, we call it socialization. It's a really useful tool to analyze systems and organizations with - not by looking at what they make possible, but also by what they encourage and discourage - most of the time, the latter are what really matter (the average case is usually what determines the long-term impact of something, not the best or the worst case). When Netflix has auto-play at the end of a stream, they shepherd you toward binging. When Animal Crossing has things you need to wait wall-clock time for, they encourage you not to binge. When free-to-play games come with loot boxes, they don't force you to do anything, but they might still be shepherding gambling-like behavior.
- c3534l 7y agoThis is what people mean when they say Haskell is "opinionated." Haskell shepherds you into separating out IO code from library code to such an extent that literally any function that has an IO action taints the value returned from that function, causing it to be an IO value, and trying to pass that IO value into another function makes the return type of that function IO, too. Parametric polymorphism is the default, too, so it also shepherds you into writing general purpose code. Haskell is full of these little decisions where it just won't let you do something because it's not "correct" code, and they kind of don't care if that makes coding in it a fight against the compiler. Rust took that philosophy and applied it pointers. Every value has a lifetime and an ownership which makes it quite hard to do things that aren't memory safe. Both Rust and Haskell wrap values that can fail in little boxes, and to get them out you have to check which type of value it is, and in C# there's nothing stopping you from returning null and not telling anyone that you can return null, and just assuming people will check for null all the time. Haskell has a philosophy of "make invalid code unrepresentable." The concept of a value being in a box, rather than null being a possible value makes it impossible to use that value without getting it out. People who write Go love that concurrency is easy and Go fmt has enforced a single canonical style. Building these sorts of things into the language goes a long way in getting them adopted and becoming the norm. I think we saw a rise of the easy, anything-goes, screw-performance scripting languages. I think the next fashion seems to be in enforcing "correct" coding style. They all have their place.
- PhilippGille 7y ago> in C# there's nothing stopping you from returning null and not telling anyone that you can return null, and just assuming people will check for null all the time You mean there was nothing? https://docs.microsoft.com/en-us/dotnet/csharp/nullable-references https://docs.microsoft.com/en-us/dotnet/csharp/nullable-refe...
- rustybolt 7y agoDoesn't that break a lot of legacy code? Also, it is certainly an improvement, but having `Foo?` as a type is still less explicit than having `Maybe<Foo>` as a type. If you miss the question mark, you can still have null pointer exceptions.
- jbritton 7y agoWhen I program in C++, there are lots of things one must consider. Should this be const, public/private, virtual, should I create a class, should I first create an abstract base class, should I create a factory, should I implement the PIMPL idiom, should this be a template function. The list of concerns is nearly endless. When I write in Python I tend to mainly think about solving my problem. In C++ I will naturally think more about performance and in Python that concern comes only if something seems slow. I make no claims about which is better, just that the language definitely affects me and the approach I take.
- DeathArrow 7y agoZX Spectrum Basic shepherded you into using goto keyword which I've heard it's the single most evil thing to do in software development.
- onion2k 7y agoIn Speccy Basic a GOTO jumped to a line number, so if you added code in that changed your numbering the GOTO broke. That was managed by using numbers that left space (10, 20, and so on), but it was still horrible in a big program. Another issue was that you couldn't go back (that's what gosub was for). They also made code hard to follow because the execution jumped around all over the place, but that was less of a problem. These days languages that have GOTO usually jump to a label so it's not quite as bad. They're still likely to end up as spaghetti though. And yes, I am old.
- pansa2 7y agoModern languages usually only support goto within a single function. This significantly reduces the potential for spaghetti, compared to 8-bit BASICs that allowed you to jump anywhere within a program.
- drewm1980 7y agoUsually people say language X "encourages" you to do Y. or "biases", but "shepherds" is a fine word too. C, C++, and Rust shepherd the programmer to use array of structure memory layout. (though it's usually not great for vectorization)
- JoeCamel 7y agoDo you have examples of languages which don't encourage you to use array of structures?
- raleighm 7y agoI like this. The insight is true of tools generally, not only languages. It's true at the feature/affordance level. Also at the tool level. "To a man with a hammer everything looks like a nail."
- fsloth 7y agoThe author is fairly insightful on various human behaviors in computing systems. You might enjoy his Mesonbuild build system[0], which has a full manual [1]. It's already used in bunch of high visibility projects [2]. [0] https://mesonbuild.com/ https://mesonbuild.com/ [1] https://meson-manual.com/ https://meson-manual.com/ [2] https://mesonbuild.com/Users.html https://mesonbuild.com/Users.html
- rienbdj 7y agoYes! Another example.of this is C# and F#. Both build on the same .net base and both are Turing complete languages with elements of OOP and FP, but wow, the code that those communities write are completely different. They each steer you in different directions.
- PeterStuer 7y agoMy take was always language quality is not about expressive power, because it's fairly difficult to come up with a non Turing complete system anyways, it is about what is easy to understand and modify.
- collyw 7y agoIsn't it a balance? VB6 code was easy to understand on one level, but its lack of expressiveness lead to a lot more code. On the other hand when I look at Ruby code there is too much syntactic sugar for a non-ruby programmers to understand it without looking some thing sup.
- kkdaemas 7y agoThis is also why CMake, even Modern CMake, is so bad. You have to fight tooth and nail for something even remotely maintainable.
- Random_ernest 7y agoAn imo really nice but lengthy explanation of this is given by Robert Martin here: https://cleancoders.com/video-details/clean-code-episode-0 https://cleancoders.com/video-details/clean-code-episode-0 He calls this restriction by paradigms.
- jt2190 7y agoThank you for sharing this. This is a much more thoughtful overview of the topic.
- DmitryOlshansky 7y agoEven broader look on this is which run-time properties the resulting _typical_ code has. Most languages tend to produce a distinct behavior patterns and properties, such as (in no particular order): - multi-threaded / single-threaded / multi-process - frequency of memory safety bugs - broken locale / unicode handling - broken or non-standard network settings handling - only synchronous I/O calls (or in contrast only async I/O) - releasing memory back to OS (or not) - fragmenting heap over time (or not) - fast / slow text processing - fast / slow binary codecs
- savolai 7y agoThe term for this in the field of human machine interaction is (perceived) affordance, popularized by Norman. This sounds like less active guidance than nudging or shepherding. Creating affordances is still an active design choice though. https://en.wikipedia.org/wiki/Affordance https://en.wikipedia.org/wiki/Affordance http://johnnyholland.org/2010/04/perceived-affordances-and-designing-for-task-flow/ http://johnnyholland.org/2010/04/perceived-affordances-and-d...
- ricardobeat 7y agoNot sure the concept applies cleanly here. Affordance is about perceiving possibilities from an interface or environment. For the subject of programming language idioms, the main factors are restrictions or patterns the language offers, and how naturally they fit within their context, not just perception by the user.
- savolai 7y agoI’m curious, how do you make the distinction that restrictions/patterns/context are not just as much perveived properties of the interface to the device you are programming? Are you perhaps perceiving perception as just visual perception? (See what I did there? :)
- deleted 7y ago[deleted]
- pietroppeter 7y agoI like the concept and I particularly like the way I feel nim shepherds me: * I very rarely need to come up with a name for a function or other identifier. The correct name can be reused for multiple use cases thanks to the type system and prox overloading. * to spend a little time designing the interface before jumping in the code * but also to think what I really need to accomplish and get to it instead of building a grandiose architecture * to have consistent apis * to steer away from OOP * to rely on minimal dependencies and to be kind of minimal in general * to use the correct tool for the problem (macro are not easy to write and that’s good otherwise you will abuse them. Instead they are great to use) * to build main table code * ... I would be interested in what other nimmers think are the good shepherding. One might also think of what is bad shepherding of nim, although nothing comes to mind at the moment.
- beagle3 7y ago> * to use the correct tool for the problem (macro are not easy to write and that’s good otherwise you will abuse them. Instead they are great to use) Just wanted to add: Nim has Macros (which are comparable to lisp forms) and Templates, which are closer to C and Lisp macros and are much harder to abuse; It also has built-in inlines and generics, which are essentially the prime use for templates and macros in languages that lack those. It also has stuff like operational transforms, which lets you state things like "whenever you see x*4 and x is an integer, use x shl 2 itself", so that you CAN apply your knowledge in the places where you know better than the compiler, while still writing the code you meant to write (multiply by 4) and not the assembly you wanted to generate. Right tool for the right job is a very good description, which I don't think many languages can claim - definitely not minimalist ones like K, nor kitchen sink ones like C++ (no, an accidentally turing complete template expansion system is NOT the right tool for compile time computation).
- chrisweekly 7y agoTitle reminds me of "guide you to the pit of success" (ie, a slippery slope w a positive ending), which IIRC I first encountered in a post by Zeit cofounder G Rauch, writing about NextJS.
- golergka 7y agoThat's exactly what I thought about. I think this is the blog post that made this phrase popular: https://blog.codinghorror.com/falling-into-the-pit-of-success/ https://blog.codinghorror.com/falling-into-the-pit-of-succes...
- qntmfred 7y agoThis is exactly what I thought of while reading the OP article. I love this metaphor and use it often
- jt2190 7y agoWhile this topic is fun, it smells like complete BS to me. Why? Because the problem of people choosing the wrong tool (not the tool "shepherding" the person into using it) is older than programming [1]. We can do better than to (once again) make up an elaborate way of blaming our tools. [1] https://en.wikipedia.org/wiki/Law_of_the_instrument https://en.wikipedia.org/wiki/Law_of_the_instrument
- Chris2048 7y agoWhat is the right tool in each of these cases? If you have a PERL codebase, do you take XML with a totally different language?
- leejo 7y ago2004-2008 I worked at The Press Association - we were processing gigabytes of XML a day, many of it in real time feeds pushed out to the likes of the BBC, large newspaper publishers, and betting shops. All of this was done with Perl. None of it was done with regular expressions - it was done through XML::LibXML, and thus libxml. Whenever I hear other perl devs complain about XML processing my answer is always the same - just use XML::LibXML. Choosing a different language might gain some advantages, but if you still choose the wrong libraries you're still going to have pain.
- Chris2048 7y agoBut if "choose the right tool" includes "use the right libraries", how does it differ from "write good code"? At that point arguing that you should use the right tool is arguing about being disciplined?
- cafard 7y ago" Yet, in practice, many Perl scripts do XML (and HTML) manipulation with regexes, which is brittle and "wrong" for lack of a better term. This is a clear case of shepherding. Text manipulation in Perl is easy. Importing, calling and using an XML parser is not." Importing, calling, and using an XML parser is straightforward in Perl. The same for HTML: think about what you want to process, what you want to ignore, and write your callbacks accordingly.
- fmakunbound 7y agoThis struck me as clueless part of the article. Perl coding was a significant portion of my career, and much of that involved web services, involving XML. I've never come across code that attempted to parse XML with regexes in Perl. It was always done with easy-to-import-and-call XML DOM or SAX parsers.
- sjakobi 7y agoThere's a similar blog post by Gabriel Gonzalez which focuses on the incentives set in Haskell: http://www.haskellforall.com/2016/04/worst-practices-should-be-hard.html http://www.haskellforall.com/2016/04/worst-practices-should-...
- skywhopper 7y agoHaha, the idea that a "proper" scripting language is more portable than a shell pipeline is amusing. Sure it is, if you can guarantee everyone has the same version of Python, and all the right libraries at the right versions, etc. But if you can do that, you can probably have them all install the GNU userland on their Macs, too.
- RMPR 7y agoTypo > shepherding An invisible property of a progamming language