I'm looking for opinions or if there is an agreed way of doing this, regarding to naming namespaced classes.
E.g.:
com.facebook.FacebookClient
vs
com.facebook.Client
Or
javax.script.ScriptEngine;
vs
javax.script.Engine;
I'm currently prefer the first name in each example but the extra word seems a bit wasteful.
Using Actionscript as an example, I'd say FacebookClient over Client. For this reason:
import com.facebook.Client;
import com.twitter.Client;
You'd have to refer to the class by it's full package to create an instance in the same class:
new com.facebook.Client();
If it was FacebookClient, I could have both
new FacebookClient();
new TwitterClient();
Plus Client would be annoying to me when code completion pops up. An extra click to select the correct Client ;)
I generally go with something like:
[company name].[project name].[functional area].[category]
i.e.
com.dave.megaproject.dataaccesslayer.postcodelookup
or in the .net world:
namespace DaveFirm.MegaProject.DataAccessLayer.PostCodeLookup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With