I just started using GitHub to socialize some projects for simple chat and peer-to-peer apps. With respect to coding, is it customary to omit exception handling, error checking, logging, etc., to promote easy-to-understand and 'clean'-looking code, if those additions are not completely necessary to actually run the code?
For instance, here's two extreme examples:
if( msg != null){
NodeEvent event = NodeEvent.valueOf(msg.getAction());
switch (event) {
case NODE_CONNECTING:
if( nodeName.isInvalid())
Utils.log("Invalid node name, ignoring...");
else{
String existingNodeAddress = _nodeNameAddressMap.get(nodeName);
if( existingNodeAddress != null)
Utils.log("Node address for '" + nodeName + "' updated");
else
Utils.log("New node '" + nodeName + "' connected");
_nodeNameAddressMap.put(nodeName, nodeAddress);
}
}
Here's the same snippet minus the fluff, although this version can easily crash if fed bad data, but otherwise it will compile and run fine:
NodeEvent event = NodeEvent.valueOf(msg.getAction());
switch (event) {
case NODE_CONNECTING:
_nodeNameAddressMap.put(nodeName, nodeAddress);
The clean version is easier to read, obviously, but is brittle. The verbose version is safer, it just looks cluttered.
I'm just curious to know if it's more effective for a social projects to go for the cleaner look at the expense of fragility, allowing those who fork the project to fill in the blanks. A quick survey of github projects and it's clear most go for the clean look.