Coding conventions

  • There should be proper javadoc including inline comments.
  • Variable names and class names should follow Standard Java naming conventions.
  • For UI variables, we will use <function-in-small-case><UIFieldType> syntax. For example, if I have a button to add dependency then the button variable name should be 'addDependencyButton'.
  • NB module packages should be preceded with org.openinstaller.devtools.[modulename] eg..
    • For module level classes - org.openinstaller.devtools.[modulename].
    • For beans & model classes - org.openinstaller.devtools.[modulename].[model]
    • For Views - org.openinstaller.devtools.[modulename].[view]
    • For Filetype support - org.openinstaller.devtools.[modulename].[filetype]
    • For module level Utility Classes - org.openinstaller.devtools.[modulename].util
  • Image names should be context specific.

<br>

  • Webrev
    • Webrev for mercurial is available at following location. [internal location.|[internallocation.]
    • Inside working directory, if you execute this command with -b"unique_bug_id" -l option. You get unique http location, that can be used for webrev.
    • Command line options:
  • -b - bug Id or unique name for web rev directory.
  • -B - Bug description
  • -f - file contains name of all files which need to generate webrev.
  • -l - lists of files which need to create webrev.

<br>
_'Note :_'All the above should be verified during code reviews along with other standard CR parameter.

Developer Best Practices

Working on Netbeans module development

  1. Always do 'Clean and Build All' on the module suite instead of individual modules. That way we can save time in future when we do the module integration. This is not different from running individual modules.
  2. The 'Run' action on the module suite does NOT do 'Clean and Build All'. We can fix this by editing the build script, but for now, always use 'Clean and Build All' before you use 'Run' on the module suite.
  3. The above actions can be easily executed if you have set the module suite as your main project among the opened projects in Netbeans. For example, you can use the keyboard shortcuts or use the main menu to execute them.
  4. When adding an existing module to the module suite, copy the module project inside the module suite directory and then add that module to the suite within Netbeans. Netbeans does not have this restriction of having individual modules inside the suite, but it helps to zip everything quickly.
  5. For all strings in double quotes that you have in the code, make sure you append '//NOI18N' (without quotes). This the convention used everywhere in the Netbeans source codes. We would like to follow it.

Netbeans module development pitfalls

  1. Sometimes, the runtime IDE crashes or does not open properly and it leaves behind the lock file. When you run the suite, Netbeans displayes an error message saying that it cannot delete the lock file. So before you run the next time, you need to manually delete the lock file after killing the hanging process. You can do this in the following way: First, goto Runtime tab and expand Process Node and right click on the build process and choose 'Terminate Process'. Then goto the 'testuserdir' under the suite folder and delete the lock file.
  2. Sometimes due to the errors in the module, you see a blank window is being shown when you run the suite. Thats because the runtime IDE did not run properly because there were serious errors in the cluster. That time you can do 'Clean and Build All' and check if the runtime IDE comes properly.

Looking for Netbeans Module Development Help?

  1. Module development Landing page: http://platform.netbeans.org/
  2. Tutorial Page: http://platform.netbeans.org/tutorials/index.html
  3. Online Javadoc: http://www.netbeans.org/download/dev/javadoc/
  4. FAQ wiki: http://wiki.netbeans.org/wiki/view/NetBeansDeveloperFAQ
  5. Geertjan's blog: http://blogs.oracle.com/geertjan
  6. Roumen's blog: http://blogs.oracle.com/roumen/
  7. Tim Boudreau's blog: http://weblogs.java.net/blog/timboudreau/
  8. Vadiraj's blog http://blogs.oracle.com/vdblog
  9. Netbeans blogger aggregation: http://planetnetbeans.org/
  10. Netbeans module development mailing list: nb-dev@netbeans.org, dev@openide.netbeans.org. We can ask questions from API related to the modules and upcoming modules. The list is highly active and there are people who answer queries.

HG Best Practices

  1. Gerard has an excellent solution about maintaining our local workspaces without corrupting them: Keep pulling always, and have the local changes locally. When you are ready for checkin, do commit and push.
  2. To check out the sources for the first time or to create a new workspace do: 'hg clone' http://repo [internal location|[internallocation]
  3. After all the testing, when you want to commit the sources, please do 'Clean All' on the suite. This will eliminate all the built files and folders. So that when we checkin, we would just be pushing only the development files.
  4. To add a new module that was copied into the existing workspace do: 'hg add' [module folder|[modulefolder]
  5. To speed up the commit process, create a new file under the .hg folder of root repository folder called hgrc. (So you create a file as .hg/hgrc under the suite folder.) and add the following lines in that file and save it:

<pre>
[paths]
default = http://[internal location|[internallocation]/repo
default-push = ssh://[internal location|[internallocation]/repo

[ui]
username = [Your user name here: firstname lastname|[Yourusernamehere:firstnamelastname] [firstname.lastname@here.COM]
</pre>
This will save some typing.

  1. To commit the sources, do: 'hg commit' [provide appropriate commit comments when hg opens up the editor|[provideappropriatecommitcommentswhenhgopensuptheeditor] and do 'hg push'. This tip is applicable only if you have created hgrc file as in the previous tip.