Skip to main content

This code is an academic example,. I was trying to write something easy because the domain is not important, but the principles and best practices.

In this code, I have a class - Table. It has a private array (of objects Cell), which is used by many public functions in the code. BUT but there is no function that will return a particular cell. So the problem I have, is how can I test the Reset function? I can call this function, but I can't review its result. Specially especially with the Option 2 where I don't have any references to this Arrayarray.

That makesgot me thinking if the design is correct.. and that lead me here.

This code is an academic example, I was trying to write something easy because the domain is not important, but the principles and best practices.

In this code I have a class - Table. It has private array (of objects Cell) which is used by many public functions in the code. BUT there is no function that will return particular cell. So the problem I have, is how can I test Reset function? I can call this function, but I can't review its result. Specially with the Option 2 where I don't have any references to this Array.

That makes me thinking if the design is correct.. and that lead me here.

This code is an academic example. I was trying to write something easy because the domain is not important but the principles and best practices.

In this code, I have a class - Table. It has a private array (of objects Cell), which is used by many public functions in the code but there is no function that will return a particular cell. So the problem I have, is how can I test the Reset function? I can call this function but I can't review its result especially with the Option 2 where I don't have any references to this array.

That got me thinking if the design is correct.. and that lead me here.

added 467 characters in body
Source Link

That makes me thinking if the design is correct.. and that lead me here.

My questions are:

  1. Do I violate any SOLID principle?
  2. Is the option 2 better way to go? (although in that case, there's no way to test it

Here's the code:

That makes me thinking if the design is correct..

That makes me thinking if the design is correct.. and that lead me here.

My questions are:

  1. Do I violate any SOLID principle?
  2. Is the option 2 better way to go? (although in that case, there's no way to test it

Here's the code:

edited tags
Link
t3chb0t
  • 44.7k
  • 9
  • 85
  • 191
added 467 characters in body
Source Link
Loading
Source Link
Loading