HNHacker News
TopNewBestAskShowJobs

drainyard

180 karma · joined October 15, 2018

submissionscomments
drainyard··on It’s time to move on from OOP?
Senior also means that I built up a certain way of reasoning and avoiding or working around common problems

I see this in my current senior colleagues, who may be very OOP-oriented but they are incredibly productive because they are super experienced in their field and in the code-base. I 100% respect that type of seniority of course, because I have learned a lot from my seniors.

Regarding my productivity I think it is first and foremost related to how my brain solves problems. I especially like the idea of Data-Oriented Design, because I think of solving programming problems as three simple steps: 1. Some data comes in 2. Data needs to be transformed into something else (based on some business rules) 3. Data needs to be presented

So when I want to solve a problem I first define my data, then I define my transformation functions and then where they are used afterwards. It's not necessarily a purely functional approach, since they do change state as opposed to returning new state, but it has very little overhead in my brain. And as you mention concurrency, it simplifies it vastly because you usually know exactly who is using which data where.

I work mostly on engine development, so there's a lot of room for optimization and understanding how a lot of data is transformed every frame, which makes performance a super interesting topic for me. I can reason much more easily about performance in a procedural code-base than in an OOP code-base, so that might be part of my bias. :)

drainyard··on I'm writing a book about algorithms and Lisp
Something like CRLS? That is fairly implementable pseudocode, but maybe still too hand wavey at times.
drainyard··on It’s time to move on from OOP?
Fair enough with that argument you can say it has a relation. I think what I was trying to say was that I don't necessarily think the authors of SDL were inspired by OOP when designing this type of interface.

Maybe we are talking next to each other about what a good programming language is.

Yes, I think we are at least in a sense. If we are speaking about programming languages from a business perspective we can agree that the language leading to the most productivity will - in a business sense - be the most optimal. I think my point is we have been productive in spite of OOP and not because of it. OOP here meaning the way it has been since Java and not Alan Kay's original ideas. When something like OOP becomes ingrained in an industry like it has been in software development in both the business and in academia, I'm not sure just waiting on the free market is going to do us any good if we (i.e. me) want to change it. Personally I am vastly more productive in the non-OOP code-bases I have worked in as opposed to the opposite. This is a personal bias, but I am no the only one and there is a growing movement of moving away from it and often already completely gone away from it. So it's not just a case of the grass being greener.

I assume you are more senior than me, since I am not particularly senior, so you can again write it off as me being a junior. But it's a growing paradigm shift, especially in game and game engine development, which is what I do for a living.

drainyard··on It’s time to move on from OOP?
SDL having an interface with handles has nothing to do with OOP and is simply the concept of opaque handles. This is often seen in data-oriented code bases where a system behind the scenes is dealing with transforming data in a hardware-oriented and cache optimized manner.

Sure the article isn't super well-written, but it raises a fair point and shouldn't just be thrown away. Just because something is the most used or standard does not mean it is the best solution. Eating junk food is very common, but you would hardly argue that it is the best way for a human to get nutrients.

You can use OOP all you want, and it's fair to say that the article should have been less biased (though he has a disclaimer that says he is biased), but there is nothing suggesting that OOP is practically the best paradigm to program most software other than the fact that it is the most used.

drainyard··on It’s time to move on from OOP?
Are you essentially saying that because you are using libraries you need OOP?

If that is what you are saying, that is nonsense.

drainyard··on Cities: Skylines Is Turing Complete
Thanks for the clarification! It's been a while since I've looked at Turing completeness.
drainyard··on We can't get enough of audiobooks
I know how you feel! I listened to "Do Android Dream of Electric Sheep" in less than a week and finished "Game of Thrones" in 3 weeks because of audio books. Before that I could barely finish a short book in a month, and a large one like "Game of Thrones" would take me most of a year to be honest.
drainyard··on Cities: Skylines Is Turing Complete
Doesn't Turing completeness require conditional loops? Considering the fact that he has AND and OR gates he can represent conditionals, but he doesn't show it. And the fact that it always terminates by design also means it solves the halting problem which by definition means it isn't Turing complete (I think?).
drainyard··on Data-Oriented Design (2018)
Also, I clearly don't know how to format lists on Hackernews...
drainyard··on Data-Oriented Design (2018)
Sure, you can cut out the user interaction, but in general it is something goes in and something comes out. I'd argue that's just a simplification and the point still stands. 1. Data goes in 2. Data is transformed 3. Data is output/displayed
drainyard··on Data-Oriented Design (2018)
Can you elaborate?

I would argue that a business domain is defined by it's data and how that data is transformed and displayed based on user input.

So simply put: 1. Data goes into system 2. Data is displayed to user 3. User interacts with data (button, CLI etc.) 4. Data is transformed based on interaction

That is ALL a program ever is. So you can model a program by just specifying the transformations that happen on each user interaction.

This can be optimized heavily if each interaction requires a large set of data to be transformed, e.g. through data oriented design you can work on big sets of data based on previous interactions and transformations and only work on data you need to work on.

It's not a design pattern. It's just a way of thinking about programs as what they are. A design pattern is something you put on top of data because you want a human understanding of business logic.

drainyard··on Data-Oriented Design (2018)
There's plenty of good talks and literature on the subject and why it is applicable to game development, but also more generally.

This talk by Mike Acton (Formerly Insomniac now Unity): https://www.youtube.com/watch?v=rX0ItVEVjHc

I recommend this talk all the time, since it is the one that got me convinced to look into DoD seriously.

Also: More Mike Acton (now at Unity): https://www.youtube.com/watch?v=p65Yt20pw0g

Stoyan Nikolov “OOP Is Dead, Long Live Data-oriented Design”: https://www.youtube.com/watch?v=yy8jQgmhbAU

Overwatch Gameplay Architecture and Netcode (More specifically about ECS): https://www.youtube.com/watch?v=W3aieHjyNvw

The main argument is that you work with data so you should care about data. All a program does is take some input, do something with it, and give you an output. If you structure your program around this mindset, a lot of problems become much simpler. Concurrency is one thing that becomes much simpler to reason about now that you understand how your data is managed and moved around. Realisations that most of the time you have multiple of something and very rarely do you have a single thing. So having a lot of small objects of the same type each doing some work within their deep call-stack, rather than running through an array of them and doing the work you need to do.

I disagree that encapsulation is a brilliant idea _in general_, because it promotes hiding data, and hiding data is not inherently good. There's obviously cases, where there is internally critical, but since all your state is simply tables of data, your program is just choosing to represent that data in some way, which can make it easier to centralize a bug early.

There's obviously pros and cons, but I don't think you should discount the possibility of it being a good idea just because it questions ideas that seem standard.

drainyard··on Logical fallacies in software engineering
That Knuth quote has to be one of the quotes that is most often taken out of context to suit a current narrative.
drainyard··on Logical fallacies in software engineering
I would argue that we have people who already are software engineers. People who know the machine their code is running on very well, and use this knowledge to fully optimize for that specific machine (embedded, console development).

They take what they are given, and engineer a solution that fits that piece of hardware as well as possible. No bullshit FactoryManagerFactory.

drainyard··on Ask HN: What overlooked class of tools should a self-taught programmer look into
One thing I always do these days is I step through any new code I've written the first time I run it. This usually weeds out some bugs that might take a while to find because they are easy to miss. It also ensures that you actually go through each line of code you write, doing a forced code review on yourself early on.
drainyard··on Single-file cross-platform C/C++ headers implementing self-contained libraries
Most people that use either Emacs or Vim for serious programming use extensions that implement code completion.
drainyard··on 24 Hours of Rust Game Development
You don't have to use an inheritance based approach if you don't make it an ECS. The point is that using any "something-based" approach is not necessary for most small and even medium sized games. Just make what seems obvious until it doesn't work and then change it. If you start thinking about architecture from the start you will have an issue when you find out it won't work for your project no matter the architecture you are using.
drainyard··on 24 Hours of Rust Game Development
This is why discipline is the one thing that differentiates developers that release something and those that don't.

It's easy to try something new all the time, but it is tough as nails to stay with something even in the many cases where it sucks and gets difficult. Finishing something is it's own reward though, so even though it's tough it's always worth it.

drainyard··on What Every Programmer Should Know About Memory (2007) [pdf]
I routinely re-watch this talk. It always gets me back in the right mindset.
drainyard··on What Every Programmer Should Know About Memory (2007) [pdf]
But learning algorithms and data structures literally requires you to know about memory on a pretty low level. As I'm sure you know, a lot of algorithms and data structures that are theoretically equal can be vastly different in practice in no small part because of how they use memory.
drainyard··on Are Mail-Order Meal Kits Doomed?
This is my main issue with these types of services. Some weeks I want to make something new/complex 4 times and some weeks I barely want to at all.

Here in Denmark we have a nice services where you can cancel your order or reorder every week, but I never know how much time I have at the beginning of the week.

drainyard··on Microsoft: 70 percent of all security bugs are memory safety issues
Unity's work on HPC# (High Performance C#) seems like a good possibility of a middle ground: Use C# where performance is not critical but you want safety, use HPC# when you absolutely need restrictions on performance.
drainyard··on Microsoft: 70 percent of all security bugs are memory safety issues
I would much rather switch to a compiler-restricted memory safe unmanaged alternative such as Rust, before I throw out performance for safety completely.

A lot of applications, such as video games, don't require the type of security others do, but require performance to a much higher degree.

Rust is a good middle-ground, since it does have some compile-time issues at the moment still which are getting better. But it is incredibly stingy about anything unsafe. Even unsafe blocks of code are borrow-checked.

Considering how slowly things run these days on any OS, and OS's specifically having performance issues, I doubt the user experience will benefit from a completely managed OS either, but I'm no expert.

drainyard··on Advice to new programmers
Most of the time when that happens to me, I try to remember all the times I did something well and didn't think about it. Usually those far outnumber the bad ones.
drainyard··on When FP? And When OOP? (2013)
You'll find that no one making a game that needs to run well uses OO, especially not AAA. Unity is going away from it as well, and they are arguably the biggest influence on hobby devs and newcomers out there. There are plenty of good talks regarding this such as Mike Acton's CPPCon keynote from 2014 https://www.youtube.com/watch?v=rX0ItVEVjHc And more Mike Acton from Unity's GDC talks https://www.youtube.com/watch?v=p65Yt20pw0g

Personally, at this point the way I write software is so far removed from this discussion that I just do what feels right and what people can generally agree on within my teams. Solve the problem, don't discuss code, discuss solving the actual problem.

drainyard··on Ask HN: What are some of the best technical talks you've heard?
Yes, I agree. It is more about a mindset rather than C++ specifically. I watch again now and then just to remind myself of the lessons that can be learned from it.
drainyard··on Ask HN: What are some of the best technical talks you've heard?
Two of my favorites:

code::dive conference 2014 - Scott Meyers: Cpu Caches and Why You Care: https://www.youtube.com/watch?v=WDIkqP4JbkE

CppCon 2014: Mike Acton "Data-Oriented Design and C++": https://www.youtube.com/watch?v=rX0ItVEVjHc

They're mostly about C++ and cache aware/data oriented programming.

← PreviousPage 2 of 2