for instance within your header file you would define your class's members from smallest to largest and have a buffer if needed. this can drastically speed up the system. that is just one thing.
well, what about in databases.
i've made a forum and there are categories and subcategories and perhaps they look like this:
Code: Select all
ROOT
|
+-- PARENT_CATEGORY_0 (1)
| +--- SUB_CATEGORY_0 (1)
| +--- SUB_CATEGORY_1 (1)
| +--- SUB_CATEGORY_2 (1)
+-- PARENT_CATEGORY_1 (2)
| +--- SUB_CATEGORY_0 (2)
| +--- SUB_CATEGORY_1 (2)
| +--- SUB_CATEGORY_2 (2)
+-- PARENT_CATEGORY_2 (3)
+--- SUB_CATEGORY_0 (3)
+--- SUB_CATEGORY_1 (3)
+--- SUB_CATEGORY_2 (3)we all understand that you can create, modify, remove categories at will cuz otherwise that would be lame to have it hard coded.
therefore the parent category's ID and parent_id would change (this is how i do categories btw) and i put them into the same table as the sub categories. some people don't agree but that's ok. that's what's awesome about programming no?
well, say it's been 5 years using this software and you've got parent category id's that range from 10-300,000. you've added and changed and deleted and moved and switched orders and all that pizzazy crap. well, that means that these things aren't in order.
thusly it would look like this:
Code: Select all
ROOT
|
+-- PARENT_CATEGORY_0 (890)
| +--- SUB_CATEGORY_0 (890)
| +--- SUB_CATEGORY_1 (890)
| +--- SUB_CATEGORY_2 (890)
+-- PARENT_CATEGORY_1 (78)
| +--- SUB_CATEGORY_0 (78)
| +--- SUB_CATEGORY_1 (78)
| +--- SUB_CATEGORY_2 (78)
+-- PARENT_CATEGORY_2 (300000)
+--- SUB_CATEGORY_0 (300000)
+--- SUB_CATEGORY_1 (300000)
+--- SUB_CATEGORY_2 (300000)remember, think of this in terms of the categories being tens deep (Children) and and possibly thousands tall (Parents)