15 ms·
I think there is a growing rebellion against the kind of software development "best practices" that result in the kind of problems noted in the article. I see s
by modeless 10y ago
I think there is a growing rebellion against the kind of software development "best practices" that result in the kind of problems noted in the article. I see senior developers in the game industry coming out against sacred principles like object orientation and function size limits. A few examples:
Casey Muratori on "Compression Oriented Programming":
https://mollyrocket.com/casey/stream_0019.html https://mollyrocket.com/casey/stream_0019.html
John Carmack on inlined code:
http://number-none.com/blow/john_carmack_on_inlined_code.html http://number-none.com/blow/john_carmack_on_inlined_code.htm...
Mike Acton on "Data-Oriented Design and C++" [video]: https://www.youtube.com/watch?v=rX0ItVEVjHc https://www.youtube.com/watch?v=rX0ItVEVjHc
Jonathan Blow on Software Quality [video]: https://www.youtube.com/watch?v=k56wra39lwA https://www.youtube.com/watch?v=k56wra39lwA
- dibanez 10y agoMuratori's compression-oriented programming and Acton's data-oriented design have really helped me in writing HPC code. Carmack's arguments make sense for apps that have a clear main function, although they're less applicable to libraries. I consider these also "best practices", they are just better for performance than object-oriented practices applied to many small objects.
- quotemstr 10y agoFor ages now, I've been telling people that the best best code, produced by the most experienced people, tends to look like novice code that happens to work --- no unnecessary abstractions, limited anticipated extensibility points, encapsulation only where it makes sense. "Best practices", blindly applied, need to die. The GoF book is a bestiary, not an example of sterling software design. IME, it's much more expensive to deal with unnecessary abstraction than to add abstractions as necessary. People, think for yourselves! Don't just blindly do what some "Effective $Language" book tells you to do. (For starters, stop blindly making getters and settings for data fields! Public access is okay! If you really need some kind of access logic, change the damn field name, and the compiler will tell you all the places you need to update.)
- jcoffland 10y agoOne of my guiding principals as a programmer is to never add code because I might need it some day.
- quotemstr 10y agoStill, apply common sense. Sometimes the probability of adding something is so high and the cost of making an extension point so low that it makes sense to design with extensibility in mind. These extension points are rare, though, and usually occur at major module boundaries (e.g., plugins), and don't need to be scattered through random bits of your code.
- jcoffland 10y agoStill, why not wait to add it?
- cle 10y agoThe cost to add it is often much higher, once the code has high fan in (lots of code paths depend on it). I am definitely a fan of not over engineering, but I'm more of a fan of thinking. Think about your problem and your use cases, and about your own ability to predict the future. If you can predict future changes with high probability, then go ahead and design for those. If you're not a domain expert, you probably can't predict the future at all (and you probably grossly underestimate how bad your predictions are), so you should stick to the bare minimum.
- jcoffland 10y agoIt's a slippery slope.
- Bahamut 10y agoBecause sometimes those choices have a large effect on the amount of work/mental tax in the future - for example, if you know that a new feature will have to interop with yours in the near future and the cost is low to implement the right extensibility point now, it would be absolutely stupid not to - I would call that bad engineering that costs time & effort. Obviously one doesn't want to go down the rabbit hole too early, but the other extreme is just as bad.
- jcoffland 10y agoRidiculously long functions are a maintainability problem but so is a ton of really small functions that do not provide a logical separation of concerns. OO code can provide modularity which can greatly improve the ability to make changes without breaking other code. On the other hand, when applied poorly it can have they opposite effect. It's not the concepts, it's how they are applied.
- quotemstr 10y agoA swarm of small functions is a worse maintainability problem --- it's not obvious how they interact to solve a particular problem, and the amount of plumbing you need to ship state between these different functions is frequently brutal. Sometimes it's easier to stick things in local variables and just have a long function. Languages that make it easy to define "local" functions that operate on implicitly captured state can help --- e.g., C++, Lisp, sometimes Java --- but only where it makes sense. I don't believe in splitting functions solely because they're too long.
- jcoffland 10y agoAgreed, but really long functions are an indication that the code could benefit from some judicious refactoring.
- staticautomatic 10y agoAnd yet invariably it's refactoring into a ton of small functions. Round and round we go...
- jcoffland 10y agoWhy? I've been recommending the middle ground all along.
- majewsky 10y ago> Languages that make it easy to define "local" functions that operate on implicitly captured state can help You don't even need that. In many languages, you can have {}-delimited blocks which cause variables inside of them to go out of scope when control flow exits them. I've used that to great effect in Perl to keep intrinsically large functions maintainable.
- the_af 10y agoNot a disagreement, but it's interesting that at least 3 of 4 of the people you mentioned are game programmers (not sure about Mike Acton because his name doesn't ring a bell). Some, like Carmack, are definitely brilliant programmers. But game programming has very specific constraints, doesn't it? Speed and size are comparatively more important than in bussiness/enterprise software, and maintenance is comparatively less important. That said, I welcome anyone trying to knock OOP off its pedestal.
- Ralfp 10y agoIt is, but every once in a while when game engine or library gets posted on, say, HN, you get the usual arguments how code is not unittestable, functions pack boatload of different behaviour into themselves or take in 20 arguments, because if it works for me in my rails app, why shouldn't it work for game engine?
- modeless 10y agoMike Acton is also a game programmer. Maybe it's just because of the sources I tend to read, but I do think the game industry is leading the way here and I hope others will follow. Perhaps it's because of the focus on performance, but I think any industry could benefit from that. I curse the lack of attention to performance in modern software development every time the Twitter app takes multiple seconds to load on my 2 GHz smartphone. > maintenance is comparatively less important I don't agree with this. Certainly maintainability is less of a concern for the gameplay code specific to each game, but game development also encompasses engines and tools which span multiple titles and are used for many, many years. Also, the trend toward free-to-play and subscription games is making maintenance more of a concern even for single titles. World of Warcraft, Team Fortress 2, League of Legends, Clash of Clans; these titles are going to be maintained for years to come. Valve Corporation recently transplanted an entire game (DotA 2) from one game engine to another, while people continued to play.
- andrepd 10y ago>I curse the lack of attention to performance in modern software development every time the Twitter app takes multiple seconds to load on my 2 GHz smartphone. I strongly agree with the sentiment, but also it should be noted that the load time of applications is related more to the storage speed, which is often abysmally bad in phones.
- virmundi 10y agoI think a lot of this could be covered by two principles that are often quoted but over looked. The first is, KISS, keep it simple stupid. The second is single responsibility. When I design software, I apply both of these to every facet of the system (though I admit sometimes not as well as I should). The end result is I might not have a ton of interfaces and hierarchies. It might not handle curve balls as well as an abstract MachineFactoryFactory could. It does handle everything that we've thrown at it however.
- GrumpyNl 10y agoI do so agree with that. Me, i am a old school programmer. Started with basic, pascal, cobol, clipper, dbase, Vb, C++, php, javascript, java. Always created the framework i needed and the libraries i needed. Straight forward piramid structure software. Everything was functions ( its coming back ). Hardly any testers other then the client and yourself. Lots of that stuf is still running. Now i'm lost a of times in the complexity of the frameworks and the use of endless classes. Debugging takes ages because some class in a total different environment is badly written. My advice, KEEP IT SIMPLE.
- qwertyuiop924 10y agoA poor programmer uses the first abstractions and ideas to come into their head, and runs with it. A mediocre programmer uses ideas and abstractions they've heard about being good ideas for this scenario, and just runs with it, occaisionally rewriting as needed. A good programmer carefully figures out what abstractions and ideas are appropriate for the job at hand, studying and rewriting until they're sure they've gotten them right, and uses them. A master programmer uses the first abstractions and ideas to pop into their head: they've been at this long enough to know the right approach.
- jtrtoo 10y agoYes. Unfortunately, as with driving, the vast majority of us think we're better than we are. It's good to have confidence, but near impossible to know when we're over estimating our own capabilities ... until it's too late. In this case it's also more difficult because one doesn't always see the end results of their output, which may also be years down the road (no pun intended).
- qwertyuiop924 10y agoThat's why becoming an master requires experience: you need experience to know what's good and bad, down the line.
- kazinator 10y ago"The code has bugs and segfaults" is a clear, objective problem. "I don't understand the code" isn't ... quite the same type of problem.
- yumaikas 10y agoOne other important thing to keep in mind when considering that crowd is that all of them are game programmers, which face a very different set of constraints than web developers (which is what I think a lot of people here are) face. That being said, I do like a lot of what they have said in the past. Not to say that the above aren't all examples of skilled programmers, and likely much more practical than a lot of people, just that they have a very different experience in the world than say, Uncle Bob or Martin Fowler. (Some of the more "best practices" developers). I think an overarching trend is that programmers in general are realizing that "best practices" like all the OOP design patterns (like the flyweight or adapter patterns) are better if you don't have to go out of your way to accommodate them, but they fit into the language well. The movement of languages like Rust, Go and Elixir (what I've been able to investigate lately) away from class-based OOP by splitting it up into its various pieces (subtyping, polymorphism, code sharing, structured types) is a good trend for the programming industry IMO. I'm looking forward to more improvements in the ability to statically verify code a la Rust. Also exciting is the improvements that C# is getting from Joe Duffy's group to help it reduce allocations and GC pressure. It's an exciting time to be in software development and to be following PTL development, some meaningful progress seems to be happening.
- alanbernstein 10y agoCasey Muratori's article really hits home for me. That's how I've felt for a long time, and I'm glad to have a coherent article to point to, to explain this to others.
- gens 10y agoA sony dev on "Pitfalls of Object Oriented Programming": http://harmful.cat-v.org/software/OO_programming/_pdf/Pitfalls_of_Object_Oriented_Programming_GCAP_09.pdf http://harmful.cat-v.org/software/OO_programming/_pdf/Pitfal...