Skip to main content
Post Closed as "Opinion-based" by user40980, Kilian Foth, jwenting, Ampt, ratchet freak
Post Reopened by Karl Bielefeldt, Rachel, user28988
[Edit removed during grace period]
Source Link
further reworded to avoid being perceived as opinion-based
Source Link

I have always wondered about this, especially in C/Java style languages. For example, consider the first 3 lines of this C# code:

lock (serviceLock)
using (var client = new ServiceClient())
try
{
    // Do something
    client.DoSomething();
}

catch (System.ServiceModel.FaultException ex)
{
    // Handle error
    addLog(ex.ToString());
}

This usage has always seemed somewhat questionable to me. However, the alternative is not very prettypractical either (3+ levels deep of indentation for a service call). Apart from pure aesthetics, is there any practical reason to add or not to add the extra brackets in this case?

I have always wondered about this, especially in C/Java style languages. For example, consider the first 3 lines of this C# code:

lock (serviceLock)
using (var client = new ServiceClient())
try
{
    // Do something
    client.DoSomething();
}

catch (System.ServiceModel.FaultException ex)
{
    // Handle error
    addLog(ex.ToString());
}

This usage has always seemed somewhat questionable to me. However, the alternative is not very pretty either (3+ levels deep of indentation for a service call). Apart from pure aesthetics, is there any practical reason to add or not to add the extra brackets in this case?

I have always wondered about this, especially in C/Java style languages. For example, consider the first 3 lines of this C# code:

lock (serviceLock)
using (var client = new ServiceClient())
try
{
    // Do something
    client.DoSomething();
}

catch (System.ServiceModel.FaultException ex)
{
    // Handle error
    addLog(ex.ToString());
}

This usage has always seemed somewhat questionable to me. However, the alternative is not very practical either (3+ levels deep of indentation for a service call). Apart from pure aesthetics, is there any practical reason to add or not to add the extra brackets in this case?

reworded question to conform to rules about opinion questions
Source Link

I have always wondered about this, especially in C/Java style languages. For example, consider the first 3 lines of this C# code:

lock (serviceLock)
using (var client = new ServiceClient())
try
{
    // Do something
    client.DoSomething();
}

catch (System.ServiceModel.FaultException ex)
{
    // Handle error
    addLog(ex.ToString());
}

This usage has always seemed somewhat questionable to me. However, the alternative is not very pretty either (3+ levels deep of indentation for a service call). WhatApart from pure aesthetics, is there any practical reason to add or not to add the best practice for Maximum Safety and Maintainabilityextra brackets in this case?

I have always wondered about this, especially in C/Java style languages. For example, consider the first 3 lines of this C# code:

lock (serviceLock)
using (var client = new ServiceClient())
try
{
    // Do something
    client.DoSomething();
}

catch (System.ServiceModel.FaultException ex)
{
    // Handle error
    addLog(ex.ToString());
}

This usage has always seemed somewhat questionable to me. However, the alternative is not very pretty either (3+ levels deep of indentation for a service call). What is the best practice for Maximum Safety and Maintainability?

I have always wondered about this, especially in C/Java style languages. For example, consider the first 3 lines of this C# code:

lock (serviceLock)
using (var client = new ServiceClient())
try
{
    // Do something
    client.DoSomething();
}

catch (System.ServiceModel.FaultException ex)
{
    // Handle error
    addLog(ex.ToString());
}

This usage has always seemed somewhat questionable to me. However, the alternative is not very pretty either (3+ levels deep of indentation for a service call). Apart from pure aesthetics, is there any practical reason to add or not to add the extra brackets in this case?

Post Closed as "Opinion-based" by gnat, user7007, user7519, Dynamic, Martijn Pieters
added 15 characters in body
Source Link
Loading
deleted 9 characters in body
Source Link
Loading
Source Link
Loading