Note that there are some explanatory texts on larger screens.

plurals
  1. POWrapping up static class with non-static class
    primarykey
    data
    text
    <p>I was looking at a project and I found something very curious.</p> <p>There is a static class that has a set of methods, where each method makes a call to a remote server.</p> <p>The template looks kind of like this:</p> <pre><code>public static class DAI public static ResponseObject ExecStatement(string db, string sql) { { ... } } public static DataSetResponseObject GetDataSet(string db, string sql) { { ... } } public static DataTableResponseObject GetDataTable(string db, string sql) { { ... } } } </code></pre> <p>But no where in the project makes a call to this class. Instead, it makes a call to an non-static class container.</p> <pre><code>public class ExecSP : IExecSP { string _db; public ExecSP(string db) { _db = db; } public ResponseObject OutputAsResponseObject(string sql) { return DAI.ExecStatement(_db, sql); } public ResponseObject OutputAsDataSet(string sql) { return DAI.GetDataSet(_db, sql); } public ResponseObject OutputAsDataTable(string sql) { return DAI.GetDataTable(_db, sql); } } </code></pre> <p>Now, the only two things I see as an advantage is that the nomenclature is more clear when wrapped up in a non-static container, and that there are less parameters to pass around.</p> <p>But I'm wondering if this is a good idea by design to wrap up static class with non-static? What are some of the other reasons if there are any? Because I assumed that creating a static and making calls to it would be okay. But this project has made it a deliberate point to wrap up all static class; and I'm not sure why.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload