Cdong Standards.

Started by
22 comments, last by timm 21 years, 12 months ago
one problem with the my___ variables is sometimes you get bad variables.

For one game we had things like:
myBalls->Scratch();


So watch out!
Advertisement
coreect speeling :>
quote:Original post by Houdini
So in closing, and IMO, the only thing that "isn''t very well thought out" was your argument for not using wrapper classes. No offense intended.

- Houdini


No offense intended from me either

I just mean that I am not going to rewrite the standard C++ library just because it doesn''t follow the same naming conventions. It would just require too much work for little gain. I don''t find have different naming conventions that big a deal. If I am using lots of functions, I can''t remember what most of them are called regardless of the naming convention; I have to look them up.

However, I would write wrapper classes for things like Direct3D, but that is only because the interface is inadequent for productive use. I do write wrapper classes for various reasons but I would never write wrapper classes for everything. It just isn''t productive, in my opinion.

quote:Original post by Anonymous Poster
I just mean that I am not going to rewrite the standard C++ library just because it doesn''t follow the same naming conventions.


Like I said, it wouldn''t be just because it doesn''t follow the same naming convention. I also I wouldn''t necessarily recommend writing wrapper classes for the whole STL either. But I''ve actually written wrapper classes around the STL containers because:

A) They have confusing function names. IE, does empty() empty the container or check if it''s empty? Does clear() clear the container or check if it''s clear?

To remove an item at a specified index you use erase(), but to remove an item from the end you use pop_back(). Why not erase() and erase_back()?

The fact that I like to reserve the name "vector" for my math library. Not that I''m worried about name conflicts (that''s what namespaces are for) but you need to look at code before you know if a variable named Vector truely is.

B) I''ve added functionality to them, like specifying whether I want the container to automatically call delete on an items it erases.

C) I extend the STL extensively by writing STL compliant containers all the time (directory iterator, string token iterators, database containers, etc) so it''s nice to be able to use the same naming convention as the rest of my custom classes.

quote:Original post by Anonymous Poster
It would just require too much work for little gain.


True, it does take a lot more effort in the beginning, but I''ve found it''s save me a lot of time later, and it''s just plain easier to work with for me.

I guess the same could be said for documenting code, or for writing technical specifications and flowcharts. Some people think the extra time spent saves them time later on, some people don''t.

quote:Original post by Anonymous Poster
I don''t find have different naming conventions that big a deal. If I am using lots of functions, I can''t remember what most of them are called regardless of the naming convention; I have to look them up.


That''s true. I also find myself looking up function names quite a bit. But I''ve also found that if I use function names that I find most natural, I can usually "guess" at the name and get it right. For instance, for any class that deletes/erases/removes an item my function name would be DeleteX() where X is the name of the item. I don''t have to check if it''s delete_x(), deletex(), deleteX(), DeleteX(), DELETE_X(), remove_x(), removex(), removeX(), RemoveX(), REMOVE_X(), erase_x(), erasex(), eraseX(), EraseX(), or ERASE_X().

Ok, ok, so that example is a bit contrived, but I hope you get my point .

quote:Original post by Anonymous Poster
However, I would write wrapper classes for things like Direct3D, but that is only because the interface is inadequent for productive use. I do write wrapper classes for various reasons but I would never write wrapper classes for everything. It just isn''t productive, in my opinion.


Well, like I said in my first post, I''m not saying that writing wrapper classes for everything is definately the best choice, but I''ve found it very helpful for me. And the extra work spent now could possibly save me a lot of time in the future.


- Houdini



- Houdini

This topic is closed to new replies.

Advertisement