10 ms·
Fun vs. Computer Science (2016)
- kybernetikos 9y agoSorry to be off topic, but I just want to mention that this site is not an AMP website, but just try browsing around it to see what a website feels like without bloat.
- Karrot_Kream 9y agoI think, to some degree, the idea that drives strongly typed, theorem proved languages is a bit different than what most people think of when coding. A large set of people in that community want to derive algorithms mathematically, using a deductive or proof based process, as in math. Iterative development conflicts with a top down form of development, and also conflicts with the safety oriented culture of strong typing. While rapid iteration languages and environments are good for initial development, they can be awful for projects requiring maintenance. About a decade ago, I built a small web app using Common Lisp (SBCL) and a lot of the development I did was done through adding new features and debugging in the REPL. While I saved the VM, reading the code months later to add a feature was terrible because the app was hacked together. I wonder if there's a way to fix this. Typed Racket looks like a promising move in that direction. FWIW, ghci already interprets Haskell quite quickly for iterative development.
- mpweiher 9y agoGood points. > derive algorithms mathematically Of course, most of what computers do is not algorithms (or even "computing"). > can be awful for projects requiring maintenance Or wonderful, see Smalltalk. Not that it is perfect and can't be improved, but it sure has been successfully maintained over a long period of time.
- mbrock 9y agoCan you expand on what is meant by algorithms and computing, and what you mean that computers mostly do instead?
- vanderZwan 9y agoThe skill of programming is really about translating tasks that are semantically meaningful to humans (ie making a user friendly online booking site for a hotel) into "meaningless" instructions that can be computed by a turing complete machine. That's very different from, say, deriving a faster partition algorithm by using half-swaps instead of full swaps (as demonstrated by Andrei Alexandrescu last year).
- Karrot_Kream 9y agoBut aren't all forms of engineering about translating semantically meaningful tasks into {problem-domain}? What makes software different?
- mcguire 9y ago"...into "meaningless" instructions that can be computed by a turing complete machine." Pssst! Hey, buddy, that's what an algorithm is.
- mpweiher 9y agoComputers today mostly (a) communicate and (b) store/retrieve data. Both at the macro level, what they are used for, but also at the micro level. Actual computation tends to be incidental.
- abhirag 9y ago"About a decade ago, I built a small web app using Common Lisp (SNACK) and a lot of the development I did was done through adding new features and debugging in the REPL. While I saved the VM, reading the code months later to add a feature was terrible because the app was hacked together. I wonder of there's a way to fix this." -- I think you might like clojure.spec, I feel that it is a step in the right direction towards keeping the flexibility and interactivity of lisp while making the code more maintainable. You can find more about it here -- [https://clojure.org/about/spec https://clojure.org/about/spec]. I also wrote a small article on it, not very detailed but maybe it can help you get a rough idea of the power of clojure.spec when combined with generative testing -- [http://abhirag.in/articles/spec_oracle.html http://abhirag.in/articles/spec_oracle.html]
- falcolas 9y agoOne thing to remember - the domain under discussion in the article is gaming. There's little maintenance typically involved with games. There's more today than there was yesterday, but it's still not a system expected to be built, maintained, and extended for decades.
- marksellers 9y agoThe engines, though, absolutely
- sbov 9y agoYeah, this sounds right 99% of the time, although there is at least one genre that, if successful, breaks that mold - MMOs. WoW is 13 years old, Everquest is 18 years old, and Ultima Online is 20 years old. For us hobbyists, there are MUD codebases based upon code written 27 years ago.
- tormeh 9y agoIf you're WoW you are printing money. You can just throw people at the problem.
- Grustaf 9y agoI'm considering writing a post about "Fun vs physics". In it I will explore rhetorical questions like "does higher build quality make formula 1 cars faster" and "do better materials in a car make it more fun to drive"
- noway421 9y agoComputer science and software development are different disciplines, and software developers do value iteration time a lot. Tooling you use and algorithms/programming language principles at play should be viewed independently.
- didibus 9y agoAgree whole heartedly! That's why my favorite language is Clojure. That interactivity, instant feedback, seeing the program running as you are tweeking it, its a bliss to use and it creates better more functional software. Imagine playing music as you hear it when trying to come up with a good melody. Now imagine not playing it, but composing it on music sheets instead, and occasionaly playing what you've got every 10 to 30 minutes. Lisp championed interactivity, it invented dynamic programming for that sole purpose. The idea is that you morph a running program into shape, molding it like you would clay. The first thing you do when writing in a Lisp like Clojure is run your program. In most other languages, running your program happens much later, and much less frequently, and it can actually be quite challenging to run.
- DonbunEf7 9y agoWell, actually, let's explore the metaphor. Here's how I compose music. First, I use a highly-flexible prototyping instrument to quickly iterate on melodic ideas. Normally this is either humming or whistling. "Our first instrument," as an instructor used to call it. I do this until the melody is catchy enough to start sticking in my mind. Then I'll look at alternate parts, like countermelodies, B/C sections, harmonies, or basslines. Each part gets repeated until it gets stuck in my head. Then, I repeatedly hum/whistle each part like a disturbed rambler until I get home or to some other place where I can scribble the parts down onto paper. I used to be faster just typing out the Lilypond, but I'm out of practice with that whereas all musicians generally never stop having a short shitty hard-to-read staff-based shorthand. Now, finally, I actually start playing the different parts on actual instruments, figuring out stuff like fingering for guitar or piano, rhythm and phrasing, filling out transition chords, etc. During this process, I play less and less of the song, drilling down to tiny fragments and setting up tiny local contexts for testing ornaments, phrasings, hits, etc. If I'm gonna try to make the metaphor rigorous, there would be only one language, because the musical process happens entirely in one language. This language is small enough to write on a single piece of paper, fully contains all of its abstractions, has focused notation for specific instruments, and permits debugging any part of a program by cutting any contiguous subprogram out and turning that fragment into its own live environment. I'd write a program first on a prototyping platform which is so lightweight that nearly any prototype program will run, and I'd use that to write out the entire first draft of my program. Then, I'd incrementally move pieces of my program transparently onto a more rigorously-precise framework which is more restrictive about types but makes it easier to compose modules and let them stay composed. There is a point in time when composition is more about managing multiple parts at once and you won't actually want to listen to more than about 15s of your song at once, and you'll want your runtime to support your quest towards stability as a basis for tweaking the fine details of your song.
- mpweiher 9y agoYes, yes, and yes. I'd go even further and claim that productivity is the ultimate currency in programming, because you can convert it into pretty much anything and everything else. Better quality, better performance, better UI. Of course, there is no guarantee that you will actually do that. Reaping these benefits does mean that you need to constantly work at improving the code, "if it ain't broke don't fix it" leads to entropy, and so does being afraid to make fundamental improvements due to lack of test coverage.
- mto 9y agoI feel it's the other way round.. Everyone is advocating Javascript, python etc. JS webapps are more and more developed directly in the browser in the dev console, CSS interactively modified to directly see the results. But this also lead us to code coverage abominations where people write hundreds of tests for manually checking input types that otherwise might crash the thing after two days running because that hashtag less of lists of objects contained a string instead of a float. Is that fun? In gaming Unity3d embraces this interactivity by modifying more or less everything directly while the game is running. The unreal engine blueprints show data flows live etc. In technical sciences there was always Matlab with its interactive mode of development. We have similar technology in data science with ipython, Spyder, jupyter notebooks etc. Actually I'm seeing more interactivity than good type systems out there. Elm, Haskell & co is something you find advocated in internet forums but rarely in companies. (and as the author mentioned - those two actually don't have to be exclusive)
- dasmoth 9y agoYes, I don't think type systems (or, in general, "computer science-y stuff") are the enemy here. I do at least wonder about some of the stuff that passes for "best practices" nowadays: CI tools sound like a good idea on the surface, but can serve to (partially) hide complex build and deployment processes where once someone might have just typed make. Automated tests of awkward corner cases can be pretty valuable, but easily lead to test suites that take minutes (or worse...) to run on every build. I don't really know how best to get the good without the bad, but giving at least some weight to the "sense of fun" stuff sounds like a pretty good starting point.
- kabdib 9y agoI have happily traded working in a nice language with slow iteration times to working in a lousy language with very, very fast turnaround. My favorite extreme example was the time I used a super fast 6502 assembler environment that would do the "change a line of code and get the target running" cycle in a couple of seconds. This kind of interaction is magical. You're still writing kind of crappy assembly language, but it almost doesn't matter. Things just flow. On the other extreme: A large component of me deciding to quit a job was the fact that a build of the product took four hours. And the build was typically broken. So: Arrive in the morning, sync, wait all morning for the build to fail. Do another cycle after lunch: fail. Go home, repeat for weeks. (Add to this: Managers who refused to buy decent development machines, people who kept checking in busted code and making things worse, and a crushing schedule. Who needs that?) These days I'm do a lot of C++, and some PHP. The C++ projects take a few minutes to build, which isn't great, but it's survivable. The PHP "builds" as fast as I can refresh a browser page. And as much as it pains me, on most days, when I grit my teeth and get honest about it, I'm more productive in PHP. And I despise PHP. I learned LISP early on in my career; wrote a few LISP interpreters, goggled at the majesty of LISP machines, read all that I could. But I've never shipped a significant project in LISP, nor am I likely to. And the Newton actually flipped from a LISP (well, OOPy-Scheme) implementation language to C++ in order to ship. I'm wondering if there is some law of human nature at work: You can have elegance and comfort or you can have a product. I sure hope I'm wrong.
- ece 9y agoTDD can help with this. I more often than not, will write a unit test or functional test first, then work on the code for that test where I'm just running that one test until it succeeds. After I have individual parts working, I will integrate everything, which again will just be another integration test run from the IDE. I realize this isn't always possible, and is probably easier to do in a managed language, but you can cut down on iteration times by mostly forcing the IDE to do incremental compiles. You can work in real-time on code that might take tens of minutes for a full build. TDD is fun.
- jnbiche 9y agoDespite being downvoted, this assertion about TDD is true. It can provide a very interactive experience when programming, even with languages with little natural interactivity. But you have to know how to set up the tests.
- sitkack 9y agoFighting with a bad technology stack definitely takes time away from the domain, where "the fighting" is different for everyone. One should be in a state of flow during dev, game or anything. So the tools that enable you to get there are the right tools. Does correctly implementing a composable state machine and effects system mean the game is more fun? Usually. This essay is full of question begging and false dichotomies.
- pjc50 9y agoI'm rather late to this party, but it is so nice using C# with "Edit and Continue". Program hit an exception? No problem! We'll just make that didn't happen(+), move the next line of execution back a bit, edit some variables, put the correct code in, and carry on. Of course, sometimes E&C just doesn't work for mysterious reasons of its own. (*) English unsurprisingly lacks an acausal past tense to describe doing something that changes an event that has already happened.
- Kluny 9y agoI think "We'll just make that not have happened..." would be correct English, but your version, though clumsy, is more evocative of what you actually meant. It's coming into more common usage, too.
- Sir_Substance 9y agoThe past is (currently) immutable, and the english idiom to handle this case is "we'll just pretend that didn't happen".
- dahart 9y agoHow about "we'll just undo that"?
- kbutler 9y ago"We'll make _it_so_ that didn't happen" sounds perfectly natural to me. Or "change it so..." We change [history/state of the world] to not include that event.
- hesselink 9y agoI feel like this is a false dichotomy: you can have a fast iteration cycle, and have statically checked guarantees. I've worked in Haskell for 7 years and had exactly this. I could load my entire app in GHCi, make changes, reload and test. Now I'm working in Java and in IntelliJ I can have something similar with hot-swap. And in the browser with typescript I have a strong type-system and can reload my app in seconds. I agree that it's easy to build a slow, batch based build system and just tell people that's how it is. Fast iteration is important and requires effort to keep working. It might even be more important than a static type system, at least for some apps. But you can have both.
- brailsafe 9y agoCorrect me if I'm wrong, but hot-swap requires a very particular set up and would be tricky to implement after a legacy java based stack has been established no? Mind elaborating on that a bit? I worked in frontend on such a system and looked far and wide for something that would let me maintain my sanity such as a turnaround time of less than 10 minutes.
- Grustaf 9y agoIt's not a dichotomy at all. Type systems etc are obviously there to make it easier, faster and safer to build and maintain your code. I'm much more productive in Swift than I ever was in objc. The one case where it might make sense to through CS out of the window is if you're building something very small that you are sure you will never reuse or even look at again. And even then I'm not sure it is faster to be sloppy.
- Grustaf 9y ago*throw (not through)
- CJefferson 9y agoOne very common complaint I've heard about Haskell is slow compile times, see this discussion for example with a bunch of GHC developers: https://www.reddit.com/r/haskell/comments/45q90s/is_anything_being_done_to_remedy_the_soul/ https://www.reddit.com/r/haskell/comments/45q90s/is_anything...
- yorwba 9y agoI think it might be possible to get the benefits of static type checking while still allowing interactive modifications, but most current type systems don't lend themselves to that. While it would be possible to replace any value by another of the same type (e.g. redefining a function without changing the signature), I'm not aware of any statically checked language with a REPL that allows that. When I'm playing around in the Haskell REPL, redefining a function requires also redefining all other functions that use it, and that's a chore that isn't even required by the type system. Other modifications are likely to break static checks, e.g. adding a new case to a sum type would invalidate exhaustiveness checking (and thus probably a bunch of compiler optimizations), so no standard type system would allow it. But having a check that makes sure you handle the added case everywhere would actually be nice to have, especially when it can tell you interactively where you need to add more code. The major hurdle to altering a running program without violating type safety is the fact that you can't just check the original program and the modified version for internal consistency, you also have to ensure that old code that's still running won't be confused when it calls new code and gets an unexpected return value. In the case of adding to a sum type, you could compile in a fall-through case for all pattern matches, and then patch in the new handler code. For even larger changes, like completely replacing the return type of a function, it might be necessary to specifically engineer the type system such that it can support this case. Ideally, it would support almost all modifications that work in a dynamically typed language, while still preventing anything that would take the program into an inconsistent state.
- hyperpape 9y agoNot sure about Haskell (what I know about the compilation model makes it seem more difficult), but in a typical Java environment (including an IDE remote debugging tomcat/jetty, for instance), the debugger will hot swap changes that are just to method bodies. The sad part is that this encourages bad development practices because piling on nested loops doesn't require bouncing the server, while properly factored code does. There are tools like JRebel that are supposed to fix this, but I haven't used them.
- catnaroek 9y ago> Ideally, it would support almost all modifications that work in a dynamically typed language, while still preventing anything that would take the program into an inconsistent state. This is impossible. Data structures have these little things called “invariants” that require proof to be established. In statically typed languages, abstract data types are used to prevent users from breaking these invariants, by making the representation invisible to anyone but the implementor. If the data structure underlying an abstract data type can be modified anytime, then every time you patch your program, you would have to check two things: (0) That the new data structure respects every invariant relied upon by other code. (1) That either the new data structure is compatible with the old one (which is often not the case), or there are no reachable instances of the old data structure in memory. This is an even bigger pain in the ass than just stopping the program and fixing it.
- kasperl 9y agoFlutter (http://flutter.io http://flutter.io) strikes an interesting balance here by (1) allowing just-in-time compiled, state-preserving "hot-reloading" during interactive development and (2) supporting optimized deployment using classical ahead-of-time compilation to native code. Disclaimer: I work on the team at Google that builds the underlying language platform for Flutter.
- mmirate 9y agoHmm, looks interesting, but it's quite unfortunate that making the compilation process be useful at runtime-error-removal is merely optional ("strong mode"). So one wonders how many shops write enough "prototype" code in "weak mode" that they decide to leave it in its Python-like mess instead of rewriting for "strong mode"...
- kasperl 9y agoDon't worry; strong mode will be the only mode going forward and it already is the only mode for Flutter. Not merely optional.
- matt2000 9y agoI have been trying out Flutter over the past week or so and so far it really has delivered on high speed build-edit loops. I've already gotten in the habit of improving layouts while the app is running, it's really a great experience. Android build times have improved a lot over the past few years but this is a whole next level experience.
- Jhsto 9y agoThank you for your work on Flutter! I tinker with it during weekends like this and despite it being my first go at mobile development, I feel productive programming in it.
- bambax 9y agoMaintainability is also important for "fun". If you can't touch the code for fear of breaking something, fixing bugs takes forever and new features / levels / versions never happen.
- falcolas 9y agoGames are rather infrequently maintained. There may be a few early patches, but after a year or so, the game is left as-is. As a great (yet personally disappointing) example, I give you Mass Effect: Andromeda. No more patches or content will be released for the single player game only 5 months after its launch. Different needs for different domains.
- vesak 9y ago>Does choosing C++14 over C++11 mean the resulting game is more fun? Even though I agree with the main point of the article, I have to point out that when a game doesn't crash every hour, it's definitely more fun. Few examples of games that do crash: many games in the Elder Scrolls series, Fallout 3 (and New Vegas), Dwarf Fortress. Games that are undeniably complex and emergent in such ways that the coders have no way of testing everything. It will be so great that people will be able to make even more complex games, and have them not crash.
- falcolas 9y agoThe article agrees. > A better argument is that some technologies may result in the game being more stable and reliable. Those two terms should be a prerequisite to fun [...]
- DerSaidin 9y ago> It's about being able to implement your ideas. This is where the choice of language might help or hinder you. One language might take longer to implement it or be more prone to bugs. The question of whether or not your ideas turn out to be fun is completely orthogonal.
- auggierose 9y agoThe thing is that most people working in academic computer science are not very good programmers. They don't have to be, as their main duty is not to produce working code, but to produce publishable papers. Of course there are very good computer scientists who are also great programmers, and this is where the practically relevant research is produced.
- dahart 9y agoWorth noting that "fun" in this case means player fun, not programmer fun. My productivity and my enjoyment of game development in C++ are secondary to the user's enjoyment of the finished game, and this is where the author's point gets more interesting and valuable. There are a lot of comments here already talking about fun, code safety, and productivity from the programmer's point of view, which IMO misses the most important part. As a game programmer, building systems with fast turnaround times is more valuable to the artists and designers in the studio than for me personally. And the value in the artists and designers and programmers all having fast turnaround time is in being able to make a game that's more fun for the consumers.
- RivieraKid 9y agoThe most fun language (having tried lots of them) I put my hands on is Julia, I just love it. You can do so much with such little effort and it can be optimized to almost match the speed of C. The 2 main downsides is the lack of proper interfaces and object.method() notation, which is sometimes more readable.
- dispo001 9y agoI will leave the details as an exercise for the reader but one would have to quantify fun in its full spectrum. Ill give you one clue or more like a hunch... If you have a tool that is trying to do everything it isn't going to be equally great at all those things and it will likely be confusing/hard to use. The generic programming languages tend to be more popular but they do so in the same way TV programs or video games are trying to appeal to an audience as large as possible. (This is how we got all these absurd hacker movies for example) In the future (lol) we will discover that single purpose languages are just better at the limited scope of things they do. PHP is perhaps a bad example that I shouldn't even have mentioned here but such a language knows exactly what its goal is in life like PHP knows it is suppose to bake websites. Maybe you've touched the awesome with your fun. Someone should try build a language entirely around the core mechanics of fun. In games there is fun in the form of rewards for stuff that just takes a fucking long time to do, there is fun from rewards for stuff that requires skill, there is fun from rewards obtained though luck, there is fun from a storyline progressing, there is fun from unexpected things, fun from buying ingame shit, fun from selling ingame shit, fun from cooperation as well as growing to be able to do those things on your own. But the real list is probably much longer. The language should probably have a basic fun object that looks something like: { temporal: 0. skilz: 0, luck: 0, story: 0, randomEv: 0, pay2win: 0, progaming:0. coop: 0, solo: 0, [...etc...] } Then you have to benchmark the fun people are taking out of a bit of code or graphics using real world data. And then.... Then you would be able to focus your attention where your effort produces the largest amount of fun as well as see the areas where your game is teh suck. Answer the big questions like what parts are people playing and why? Where do they rage quit? If they didn't give up on creating content for Diablo 2 I would probably still be playing it. If they had a language where fun was the central mechanic they would have known that changing all the items and ruining all the heroes had a negative dev time to fun conversion ratio. It wouldn't have to be limited to games at all. One could quantify the fun on HN using the same language. It would all of a sudden be obvious that the karma system and submission ranking lacks random rewards and events. A thing no one considered up to now but if we know it is fun and the system is lacking it it becomes worth considering it. </fun>
- srtjstjsj 9y agoHas anyone seen the straw man that article argues against? What does "computer science" have to do with "writing games"?
- rubmo 9y ago>pretend all the computers in the movie work like your desktop PC. RIP Matt Damon.
- stevenschmatz 9y agoThis is exactly why I switched from native iOS development to React Native. Swift is really nice and probably my favorite compiled language right now, but 10s+ compile times will never compare to hot reloading in React Native, period.
- mannykannot 9y agoThe author has a point that I generally agree with, but note that PHP, JavaScript and Basic all went through a phase of revision that made them more 'CS conformal', removing some notable corner cases in how they worked. (On the other hand, C++ has also had some corner cases removed over the years...)
- c3534l 9y agoVideo games are getting massive and they're not slowing down much. We're relying more and more on the engine to do the hard work for us and leaving the creative stuff to the humans. The only way I can see video games moving forward is to have a massive fixed costs of development in reusable, optimized code, and push all the variable costs onto the individual game made by the individual humans making them. The stuff that goes in libraries and into the game engine and even the tools needs to start sticking around longer and to be sane and safe. Basically, it's what almost every engine has already discovered: game scripting and game logic can use its own language optimized for development time and accessibility. We can leave Python to the animators and level designers, but keep your Rust and your Go and your fancy data structures to people who are building the infrastructure.
- SZJX 9y agoGame programming is never about comfortable programming languages. I think this is pretty well known isn't it. In other programming fields I'd say the experience is definitely getting more and more "fun", headache-free and productive in general.