An interesting reddit comment on code structure

General discussion regarding the OpenMW project.
For technical support, please use the Support subforum.
User avatar
raevol
Posts: 3085
Joined: 07 Aug 2011, 01:12
Location: Caldera

An interesting reddit comment on code structure

Post by raevol » 28 Dec 2016, 08:38

So, this guy was commenting on our code on reddit: https://www.reddit.com/r/linux_gaming/c ... d/dbol53v/

Now, please understand that it is highly likely that this guy doesn't know what he is talking about, and we should just ignore it. I take what this guy is saying with a massive heap of salt because I have seen our devs do awesome work, and even though I can't read our code myself, I assume that it is waayyyy better than this guy is saying,

But I think it's worth discussing. Are we losing potential devs because our code is a mess? Again, my assumption is we are not. I think our devs are doing an awesome job. But ... can we take a minute of introspection to consider this?

User avatar
sjek
Posts: 437
Joined: 22 Nov 2014, 10:51

Re: An interesting reddit comment on code structure

Post by sjek » 28 Dec 2016, 09:46

+1 :mrgreen:
i think same point have been made numerous times but the clear swording has been missing and the answer been that restructuring for later. to my knowledge the codebase is kinda directly coded in accordance to morrowind game mechanics.

.?
"life is crazy"
"craziness has beauty which only crazies understand" some movie clip in the head.
https://wiki.openmw.org/index.php?title=Testing

User avatar
psi29a
Posts: 4881
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: An interesting reddit comment on code structure

Post by psi29a » 28 Dec 2016, 10:09

To save others a trip:
Pewspewpew wrote:Well, as I said, maybe just my standards. When i played with it I found it, it ignored DRY and single responsibility principle, had undescriptive naming for both functions and files, no directory structuring, had little to no comments, rendering and camera manipulating code was all over the place and other small stuff. I just want to say with this that when I wanted to jump in and help developing at least a bit, my desire was washed right away, as I did not want to read the code/docs for months.

User avatar
AnyOldName3
Posts: 1875
Joined: 26 Nov 2015, 03:25

Re: An interesting reddit comment on code structure

Post by AnyOldName3 » 28 Dec 2016, 18:14

When I messed with the config loading code, it took me a day or two to figure out what was going on. We could probably do with some more high-level documentation which explains what does what, why, and when. Done right, it should let people figure out what part of the code covers a specific issue they're investigating a lot faster.

That said, once I figured out what was going on, it was obvious that the complexity wasn't necessarily OpenMW's fault, but instead the part of Boost that was being used.
AnyOldName3, Master of Shadows

Chris
Posts: 1579
Joined: 04 Sep 2011, 08:33

Re: An interesting reddit comment on code structure

Post by Chris » 29 Dec 2016, 02:42

OpenMW's code structure certainly isn't as great as it could be. Much of it was written ad-hoc to get something that works, and paying less attention to proper design and overall structure. There could also be parts that are over-engineered, accounting for potentialities that are unnecessary. This tends to be the case when it comes to free software, since contributors generally don't tend have as much experience to have a good grasp on "best practice", and even when they do, don't have the same amount of time to make sure the code is properly cleaned up.

Not to say it's all bad, of course. The code is in a much better position now than it used to be, and it does get improved over time. And there definitely is "professional" code that developers should be ashamed to have written (or be angry at their employer for forcing them to). There's also the fact that software development is constantly moving forward, so what was good yesterday when it was written may no longer be good today.

So there's a certain degree of subjectivity to it, but OpenMW's code design and structure could stand for improvement. How bad it is in the grand scheme of things, I'm not qualified to say, but it's good enough to work and keep working.

User avatar
raevol
Posts: 3085
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: An interesting reddit comment on code structure

Post by raevol » 29 Dec 2016, 03:15

I think this is why a push for documentation would help. I found when I was writing the game I was writing a while back, when I did a documentation pass I cleaned up code at the same time, because it was embarrassing to write "this code sucks but hey" as documentation.

User avatar
wareya
Posts: 338
Joined: 09 May 2015, 13:07

Re: An interesting reddit comment on code structure

Post by wareya » 29 Dec 2016, 04:33

Chris wrote: So there's a certain degree of subjectivity to it, but OpenMW's code design and structure could stand for improvement. How bad it is in the grand scheme of things, I'm not qualified to say, but it's good enough to work and keep working.
OpenMW is substantially better than most game engines in terms of code structure.
paying attention to #1751 #2473 #3609 #3862/#3929 #3807 #4297 #4623

SquireNed
Posts: 402
Joined: 21 Dec 2013, 22:18

Re: An interesting reddit comment on code structure

Post by SquireNed » 29 Dec 2016, 04:33

The only danger I could see in that is whether or not the people doing the documentation pass would be able to go in and actually understand what each piece of code is doing.

I assume that right now a documentation pass would mean that current developers take time off of development in order to try to do stuff, which seems a little untenable given that we're not all that far from a potential 1.0.0 release at which point it would be much easier to go back and work on documentation and fixing things without having people yammering about new stuff on quite so many fronts.

User avatar
raevol
Posts: 3085
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: An interesting reddit comment on code structure

Post by raevol » 29 Dec 2016, 07:54

SquireNed wrote:I assume that right now a documentation pass would mean that current developers take time off of development in order to try to do stuff, which seems a little untenable given that we're not all that far from a potential 1.0.0 release at which point it would be much easier to go back and work on documentation and fixing things without having people yammering about new stuff on quite so many fronts.
Currently we are an infinite distance from 1.0 given that certain release-blocking features are not being worked on at all. Mostly because new devs tackling those said features cannot get enough of a handle on the code to be able to work on them.

If you are at point A and you are trying to get to point B, how long will it take you if your speed is zero?

User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: An interesting reddit comment on code structure

Post by Zini » 29 Dec 2016, 09:21

Our code uses some unorthodox approaches in some places, which go back to the very beginning (e.g. managing of references). This may put some people off, but it is too late to change that now and frankly I don't see a reason to anyway, because the code served us surprisingly well.
I agree that we could use some more higher level documentation (what is what, what does what, how does it generally work). And there are certainly some parts of the code that could use some cleanup.

But most of this reddit post is just plain BS. And I don't believe that the state of the codebase is a reason for slower development. We are making slow progress in some areas, because the remaining problems are hard. No documentation or code cleanup will change that.

Post Reply