| 108 | == Folder Hierarchy == |
| 109 | |
| 110 | Just as the file name reflects the class name, the folder hierarchy will reflect the namespace or module hierarchy. If MgClassA is defined in the namespace OSGeo.!MapGuide.!DataAccess, then relative to the project root all source files for MgClassA will reside in the OSGeo\!MapGuide\!DataAccess folder. You will see this hierarchy reflected in the source control application. Again, having the hierarchies match up makes it very easy to navigate to where you want to go. |
| 111 | |
| 112 | A consequence of this rule is that if you change a namespace or module then you will also have to rename or restructure the file hierarchy. |
| 113 | |
| 114 | == Deleting Files and Projects == |
| 115 | |
| 116 | Eventually everyone needs to remove files and/or projects from the main source. If you’re removing files, you update the Visual Studio solution file and if applicable the Linux build script. Having done this, you still need to remove the file / project from the source control application. |
| 117 | |
| 118 | == General Structure of !MapGuide Files |
| 119 | |
| 120 | We would like all !MapGuide files to have a similar structure: |
| 121 | |
| 122 | 1. Copyright info |
| 123 | * every source file must have this at the top |
| 124 | * the actual text in the copyright is subject to change, but that doesn’t mean we shouldn’t add it |
| 125 | * whenever you create a new file, find another file with the copyright and paste that into your new file |
| 126 | 1. Import of .NET namespaces (If applicable) |
| 127 | * ideally sorted alphabetically |
| 128 | 1. Import of local namespaces (If applicable) |
| 129 | * ideally sorted alphabetically |
| 130 | 1. Namespace info (If applicable) |
| 131 | * as mentioned above, the namespace matches the folder path of the source file(s) |
| 132 | 1. Class declaration |
| 133 | * includes seed documentation |
| 134 | 1. Constant declarations |
| 135 | 1. Local variable declarations |
| 136 | 1. Inner classes separated by section comments (If applicable) |
| 137 | 1. Constructors |
| 138 | 1. Properties/methods |
| 139 | |
| 140 | |
| 141 | For example: |
| 142 | {{{ |
| 143 | #!cpp |
| 144 | // |
| 145 | // Copyright (C) 2004-2008 by Autodesk, Inc. |
| 146 | // |
| 147 | // This library is free software; you can redistribute it and/or |
| 148 | // modify it under the terms of version 2.1 of the GNU Lesser |
| 149 | // General Public License as published by the Free Software Foundation. |
| 150 | // |
| 151 | // This library is distributed in the hope that it will be useful, |
| 152 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 153 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 154 | // Lesser General Public License for more details. |
| 155 | // |
| 156 | // You should have received a copy of the GNU Lesser General Public |
| 157 | // License along with this library; if not, write to the Free Software |
| 158 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 159 | // |
| 160 | |
| 161 | using System; |
| 162 | using System.Runtime.Serialization; |
| 163 | |
| 164 | namespace OSGeo.MapGuide.DataAccess.Tools |
| 165 | { |
| 166 | /// <summary> |
| 167 | /// Provides the base functionality for ... |
| 168 | /// </summary> |
| 169 | [Serializable] |
| 170 | public class MyClass : ISerializable |
| 171 | { |
| 172 | //------------------------------------------------------- |
| 173 | // Constants |
| 174 | //------------------------------------------------------- |
| 175 | Constants |
| 176 | |
| 177 | //------------------------------------------------------- |
| 178 | // Variables |
| 179 | //------------------------------------------------------- |
| 180 | Variables |
| 181 | |
| 182 | //------------------------------------------------------- |
| 183 | // Inner classes |
| 184 | //------------------------------------------------------- |
| 185 | Inner classes |
| 186 | |
| 187 | //------------------------------------------------------- |
| 188 | // Constructors |
| 189 | //------------------------------------------------------- |
| 190 | Constructors |
| 191 | |
| 192 | //------------------------------------------------------- |
| 193 | // Properties / Methods |
| 194 | //------------------------------------------------------- |
| 195 | Properties / Methods |
| 196 | } |
| 197 | } |
| 198 | }}} |
| 199 | |
| 200 | |