Skip to content

Commit fe10f3a

Browse files
author
timlinux
committed
Added some notes about API compatibility
git-svn-id: http://svn.osgeo.org/qgis/trunk@9647 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent fc69da7 commit fe10f3a

File tree

2 files changed

+76
-20
lines changed

2 files changed

+76
-20
lines changed

CODING

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ Developers guide for QGIS
2424
1.7.1. Tabs
2525
1.7.2. Indentation
2626
1.7.3. Braces
27-
1.8. Coding Style
28-
1.8.1. Where-ever Possible Generalize Code
29-
1.8.2. Prefer Having Constants First in Predicates
30-
1.8.3. Whitespace Can Be Your Friend
31-
1.8.4. Add Trailing Identifying Comments
32-
1.8.5. Use Braces Even for Single Line Statements
33-
1.8.6. Book recommendations
27+
1.8. API Compatibility
28+
1.9. Coding Style
29+
1.9.1. Where-ever Possible Generalize Code
30+
1.9.2. Prefer Having Constants First in Predicates
31+
1.9.3. Whitespace Can Be Your Friend
32+
1.9.4. Add Trailing Identifying Comments
33+
1.9.5. Use Braces Even for Single Line Statements
34+
1.9.6. Book recommendations
3435
2. SVN Access
3536
2.1. Accessing the Repository
3637
2.2. Anonymous Access
@@ -273,13 +274,41 @@ Braces should start on the line following the expression:
273274

274275

275276

276-
1.8. Coding Style
277+
1.8. API Compatibility
278+
======================
279+
280+
From QGIS 1.0 we will provide a stable, backwards compatible API. This will
281+
provide a stable basis for people to develop against, knowing their code will
282+
work against any of the 1.x QGIS releases (although recompiling may be
283+
required).Cleanups to the API should be done in a manner similar to the
284+
Trolltech developers e.g.
285+
286+
287+
class Foo
288+
{
289+
public:
290+
/** This method will be deprecated, you are encouraged to use
291+
doSomethingBetter() rather.
292+
@see doSomethingBetter()
293+
*/
294+
bool doSomething();
295+
296+
/** Does something a better way.
297+
@note This method was introduced in QGIS version 1.1
298+
*/
299+
bool doSomethingBetter();
300+
301+
}
302+
303+
304+
305+
1.9. Coding Style
277306
=================
278307

279308
Here are described some programming hints and tips that will hopefully reduce errors, development time, and maintenance.
280309

281310

282-
1.8.1. Where-ever Possible Generalize Code
311+
1.9.1. Where-ever Possible Generalize Code
283312
==========================================
284313

285314

@@ -294,7 +323,7 @@ This will:
294323
maintain for others
295324

296325

297-
1.8.2. Prefer Having Constants First in Predicates
326+
1.9.2. Prefer Having Constants First in Predicates
298327
==================================================
299328

300329
Prefer to put constants first in predicates.
@@ -308,7 +337,7 @@ logic bugs. The compiler will generate an error if you accidentally use "=" ins
308337
inherently cannot be assigned values.
309338

310339

311-
1.8.3. Whitespace Can Be Your Friend
340+
1.9.3. Whitespace Can Be Your Friend
312341
====================================
313342

314343
Adding spaces between operators, statements, and functions makes it easier for humans to parse code.
@@ -326,7 +355,7 @@ or this:
326355

327356

328357

329-
1.8.4. Add Trailing Identifying Comments
358+
1.9.4. Add Trailing Identifying Comments
330359
========================================
331360

332361
Adding comments at the end of function, struct and class implementations makes it easier to find them later.
@@ -346,7 +375,7 @@ E.g.,
346375

347376

348377

349-
1.8.5. Use Braces Even for Single Line Statements
378+
1.9.5. Use Braces Even for Single Line Statements
350379
=================================================
351380

352381
Using braces for code in if/then blocks or similar code structures even for single line statements means that adding another
@@ -378,7 +407,7 @@ So, prefer this:
378407

379408

380409

381-
1.8.6. Book recommendations
410+
1.9.6. Book recommendations
382411
===========================
383412

384413
* Effective C++ (http://www.awprofessional.com/title/0321334876), Scott Meyers
@@ -1234,10 +1263,10 @@ guidelines are followed in layout and design of GUIs.
12341263

12351264
1. Group related elements using group boxes:
12361265
Try to identify elements that can be grouped together and then use
1237-
group boxes with a label identify the topic of that group.
1266+
group boxes with a label to identify the topic of that group.
12381267
Avoid using group boxes with only a single widget / item inside.
1239-
2. Capitalise first letter only in group box labels:
1240-
Group box labels should be written as a phrase with leading capital letter,
1268+
2. Capitalise first letter only in labels:
1269+
Labels (and group box labels) should be written as a phrase with leading capital letter,
12411270
and all remaing words written with lower case first letters
12421271
3. Do not end labels for widgets or group boxes with a colon:
12431272
Adding a colon causes visual noise and does not impart additional meaning,

doc/CODING.t2t

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,33 @@ Braces should start on the line following the expression:
195195
}
196196
```
197197

198+
== API Compatibility ==
199+
200+
From QGIS 1.0 we will provide a stable, backwards compatible API. This will
201+
provide a stable basis for people to develop against, knowing their code will
202+
work against any of the 1.x QGIS releases (although recompiling may be
203+
required).Cleanups to the API should be done in a manner similar to the
204+
Trolltech developers e.g.
205+
206+
207+
```
208+
class Foo
209+
{
210+
public:
211+
/** This method will be deprecated, you are encouraged to use
212+
doSomethingBetter() rather.
213+
@see doSomethingBetter()
214+
*/
215+
bool doSomething();
216+
217+
/** Does something a better way.
218+
@note This method was introduced in QGIS version 1.1
219+
*/
220+
bool doSomethingBetter();
221+
222+
}
223+
```
224+
198225

199226
== Coding Style ==
200227

@@ -1108,10 +1135,10 @@ guidelines are followed in layout and design of GUIs.
11081135

11091136
+ Group related elements using group boxes:
11101137
Try to identify elements that can be grouped together and then use
1111-
group boxes with a label identify the topic of that group.
1138+
group boxes with a label to identify the topic of that group.
11121139
Avoid using group boxes with only a single widget / item inside.
1113-
+ Capitalise first letter only in group box labels:
1114-
Group box labels should be written as a phrase with leading capital letter,
1140+
+ Capitalise first letter only in labels:
1141+
Labels (and group box labels) should be written as a phrase with leading capital letter,
11151142
and all remaing words written with lower case first letters
11161143
+ Do not end labels for widgets or group boxes with a colon:
11171144
Adding a colon causes visual noise and does not impart additional meaning,

0 commit comments

Comments
 (0)