DOH!!!
-
Pete O'Hanlon wrote:
As no one else has pointed it out, where were the unit tests? A comprehensive test would have picked this up long before.
Does scrum or agile have unit tests?
Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004
Yes.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.
private void DeleteSelectedRows()
{
if (accountsUltraGrid.Selected.Rows.Count > 0)
{
string message = "Are you sure you want to delete the selected accounts?";
if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
{
foreach (var gridRow in accountsUltraGrid.Selected.Rows)
{
Account account = gridRow.ListObject as Account;host.GetProxy().DeleteAccount(account); totalRowCount--; } } }
}
If it's not broken, fix it until it is
-
Unit testing user interface is hard and generally missed out. Since the bug was actually in the line that checked the UI response I can see how this could easily slip through testing.
And this is why I love working with MVVM and WPF - that wouldn't have been user interface code (and it didn't actually need to be there in this case either).
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
And this is why I love working with MVVM and WPF - that wouldn't have been user interface code (and it didn't actually need to be there in this case either).
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
Surely whatever framework you're using you're going to have a line like
if(DialogResult.Yes == MessageBox.Show( ... )){
modelView.DoDeleteRows(selectedRows);
}... in the UI layer? User confirmation in the UI is part of the requirement here. If you screw up that line, which is what happened here, your model-view and model code can be as perfect and as tested as you like and you can still make this mistake.
-
Surely whatever framework you're using you're going to have a line like
if(DialogResult.Yes == MessageBox.Show( ... )){
modelView.DoDeleteRows(selectedRows);
}... in the UI layer? User confirmation in the UI is part of the requirement here. If you screw up that line, which is what happened here, your model-view and model code can be as perfect and as tested as you like and you can still make this mistake.
Nope. I'd use Dependency Injection to control the message box, so it would look something like this:
IMessageBoxService mbox = ServiceContainer.Resolve();
bool? result = mbox.Show("....")
if (result.HasValue && result)
{
DeleteRows();
}There's no need to have a selecteRows property because this would have been handled with the binding.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
That might be because there is no MessageBox.ShowDialog method... :-D
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
-
This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.
private void DeleteSelectedRows()
{
if (accountsUltraGrid.Selected.Rows.Count > 0)
{
string message = "Are you sure you want to delete the selected accounts?";
if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
{
foreach (var gridRow in accountsUltraGrid.Selected.Rows)
{
Account account = gridRow.ListObject as Account;host.GetProxy().DeleteAccount(account); totalRowCount--; } } }
}
If it's not broken, fix it until it is
-
This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.
private void DeleteSelectedRows()
{
if (accountsUltraGrid.Selected.Rows.Count > 0)
{
string message = "Are you sure you want to delete the selected accounts?";
if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
{
foreach (var gridRow in accountsUltraGrid.Selected.Rows)
{
Account account = gridRow.ListObject as Account;host.GetProxy().DeleteAccount(account); totalRowCount--; } } }
}
If it's not broken, fix it until it is
That's a pretty adequate programming style when you want to test your maintenance programmers. Hardly anyone will spot it.
-
This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.
private void DeleteSelectedRows()
{
if (accountsUltraGrid.Selected.Rows.Count > 0)
{
string message = "Are you sure you want to delete the selected accounts?";
if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
{
foreach (var gridRow in accountsUltraGrid.Selected.Rows)
{
Account account = gridRow.ListObject as Account;host.GetProxy().DeleteAccount(account); totalRowCount--; } } }
}
If it's not broken, fix it until it is
-
This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.
private void DeleteSelectedRows()
{
if (accountsUltraGrid.Selected.Rows.Count > 0)
{
string message = "Are you sure you want to delete the selected accounts?";
if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
{
foreach (var gridRow in accountsUltraGrid.Selected.Rows)
{
Account account = gridRow.ListObject as Account;host.GetProxy().DeleteAccount(account); totalRowCount--; } } }
}
If it's not broken, fix it until it is
Happened to me in c++ as a student, nearly gave up programming because of it :)
____________________________________________________________ Be brave little warrior, be VERY brave