| 1 | = Basic coding tips: Getting to grips with Orxonox code = |
| 2 | |
| 3 | Often you'll find yourself in a situation where you have to work on a large code |
| 4 | project you've never been involved with before. In such a situation, it is important |
| 5 | to work systematically. This page tries to give hints and present software tools that |
| 6 | are useful in doing so. |
| 7 | |
| 8 | == Navigating code with Eclipse == |
| 9 | Using an integrated development environment such as Eclipse can make your life a lot |
| 10 | easier by providing tools to jump around in a project. A few important shortcuts are |
| 11 | presented below: |
| 12 | - '''Ctrl-LeftClick''' on anything: takes you to where it was defined. |
| 13 | - '''Ctrl-Hover''': More advanced version of Ctrl-LeftClick, lets you choose to go to |
| 14 | implementation, declaration or super-declaration (not the same as super sayans :D) |
| 15 | - '''Alt-Left''': go back to where you came from after doing '''Ctrl-LeftClick''' on something |
| 16 | - '''Ctrl-H''': (Choose the 'File Search' tab): Search for text across the project |
| 17 | - '''Ctrl-Spacebar''': Completion of functions, arguments etc |
| 18 | |
| 19 | == Getting help: Documentation and authorship == |
| 20 | It makes a lot of sense to find out what documentation there is and who wrote the code |
| 21 | you're concerned with. In terms of who wrote some code, look at the beginning of the file |
| 22 | to see who the author is. Alternatively, try |
| 23 | {{{ |
| 24 | svn blame filename |
| 25 | }}} |
| 26 | This outputs (rather verbosely) who wrote what line in the given file. Contact them if |
| 27 | anything is unclear. The documentation of Orxonox is built by doing the following in the |
| 28 | build folder: |
| 29 | {{{ |
| 30 | make doc |
| 31 | }}} |
| 32 | as soon as this is done, open |
| 33 | {{{ |
| 34 | build/doc/api/html/index.html |
| 35 | }}} |
| 36 | In a web browser to get to the main page of the documentation. From there, you can enter |
| 37 | the name of what you're looking for in the search bar on the top right. |
| 38 | |
| 39 | == General important tips == |
| 40 | Some or all of the following are simply good practice for any project: |
| 41 | - '''Keep a log''' of your activities and progress. This does not have to be very formal and |
| 42 | can be in the SVN commit messages, on a wiki page or anything you like. The more verbose, |
| 43 | the better. Trust me (I'm an engineer :D). |
| 44 | - '''Document all the changes''' you do in '''SVN'''. Try to commit after every big change or addition |
| 45 | you do to code and clearly write what has changed. Browsing code differences is as boring |
| 46 | as it sounds. |
| 47 | - '''Write the documentation while you write the code'''. If you implement a feature, create a wiki |
| 48 | page on how it works conceptually, what files are involved in its implementation and |
| 49 | - If you work with a lot of different files, it can be useful (especially at the beginning of |
| 50 | your work) to also keep a list of relevant files and a few comments on what is where. |