1,578 reputation
717
bio website
location
age
visits member for 3 years
seen Jul 7 at 20:06

May
4
comment MVC: Does the Controller break the Single Responsibility Principle?
@prog IMO The controller should be blind to the view. A button will have some sort of functionality but it doesn't need to know the details of it. It just needs to know that it is sending some data to a controller method. In that regard the name doesn't matter. It can be called foo, or just as easily fireZeMissiles. It will only know that it should report to a specific function. It doesn't know what the function does only that will be calling it. The controller isn't concerned with how its methods are invoked just that it will respond in a certain manners when they are.
Feb
4
comment Should a method in a class be aware that the class has “loaded” a variable?
By moving the success of the other methods outside of the class, we then no longer have to worry about their success. The OP was asking what if anything should be returned by the other methods, my answer being that the methods shouldn't exist. But I do see what you are saying.
Jun
20
comment What is the reason for using lowercase for the first word in a local variable (eg, employeeCount, firstName)
@user61852 There is a naming convention. The OP has a convention where everything starts with a capital letter.
Jun
19
comment What is the reason for using lowercase for the first word in a local variable (eg, employeeCount, firstName)
@N4TKD if the entire project was written in that manner, I could get used to it (I wouldn't like it necessarily). I updated my question in regards to working with other devs. The OP was also asking for a reason that the standard is the way it is.
May
17
comment Is there a point to unit tests that stub and mock everything public?
In the method that you are talking about, I am making sure that the proper calls are being made. The method's job is to call objectA.foo() then objectB.bar() so that is what I am going to make sure. Suppose at some future date, the order matters. You are able to adjust the test to ensure this. Or that conditionally objectC.baz() will be called, the test will ensure that.
May
17
comment Is there a point to unit tests that stub and mock everything public?
Yes. The method does something doesn't it? So it should be tested. From a testing stand point I don't know if it is using anything private. I just know that if I provide input A, I should get output B.
May
17
comment Is there a point to unit tests that stub and mock everything public?
If the method is private, you don't test it explicitly, it should be tested via the public interface. All public methods should be tested, to ensure that the behavior is correct.
May
5
comment Using only UI testing. Is that Ok?
Some testing is better than no testing. But just keep in mind that you will have a hard time getting good code coverage with UI testing alone.
Apr
8
comment If functional testing is referred as black box..how can it be done on unit test level?
You need to be able to see what is going on to determine lower level units so hence white box. But when doing the test it would be considered black box as you are not looking at what is going on inside the system.
Mar
1
comment What's the standard practice to prevent users from having unreasonable expectations?
@AakashM To me that is semantic, I would say expecting that a system work all the time is not unreasonable. Understanding the fact that things don't always work is something different.
Feb
4
comment How should you TDD a Yahtzee game?
Thorough testing doesn't mean testing every combination... That is silly. For this particular case, take a particular full house or two and a couple of non full houses. Also any special combinations that could cause trouble (ie, 5 of a kind).
Jan
29
comment Specifying Query in Unit Test
What about the db mock for the CustomerMapper test?
May
18
comment TDD: Am I doing it right?
I don't mean that the method isn't tested. It is just checked via confirming that other methods are set or during the actual setting up of a test. If the getter or setter doesn't work properly, the test will fail because the properties weren't set correctly. You get them tested for free, implicitly.
Mar
9
comment Do I need to test everything?
I disagree. If you can't make it happen either via a mock or passing in data, then why have it in your code. Getters and setters don't need their own tests put would be tested via other unit tests of the system for verifying the expected functionality.
Mar
9
comment Unit testing - Database coupled app
+1 for defining the boundary of what you are testing
Feb
29
comment Add a unit test for each new bug
+1 for a good way to introduce unit tests