Re: [Yact-dev] Null object
Status: Pre-Alpha
Brought to you by:
basic
|
From: Daniel B. <ba...@we...> - 2000-04-12 20:08:37
|
On Mon, Mar 13, 2000 at 08:54:22PM -0800, Marius Sundbakken wrote: > I think we should add a YNullable interface (or similar): > [..] > Let's get rid of as many "if pointer is not null" statements as > possible. Well, there aren't that many of those there, actually. Lots of them disappeared when I pushed the gui logic to YInputHandler, and the ones that are left are mostly in the subclasses to that class. > I think this will make Yact a lot more stable (the risk of > coredumping is greatly reduced) and code-flow in general will be much > cleaner, prettier, and easier to read. No more of those annoying null > pointer if's, and just go ahead and access the object directly. I'm not so sure about that. I kind of like core dumps, because they let you know very quickly when something is wrong with the program. If some method gets a null pointer when it shouldn't, the fix is to get rid of that null pointer, not add a "if (!p) return". Sometimes null objects are ok though, and when that situation comes up, I'll have no problem introducing YNull(able). I don't see much use for it right now, though. Do you (apart from that bug below)? > You can already get Yact to crash by playing around with adding new > classes and adding inheritance and deleting them etc. I don't know > where the bug is exactly, but I bet it's a null pointer. I don't remember where it was, but it was a bad pointer somewhere... It's fixed now, anyway. :) /Basic |