A "New" Way to practice TDD
-
One of my proteges[^] is working for a company who swears that the "best" way to do TDD is to write the code first, and then make the test pass AFTER everything has been written. He has pretty much done everything he possibly could to convince the management and his coworkers that they've got it all backwards, but they insist that they don't need to learn anything about patterns since their Oracle Framework (which is a Developer Preview edition, btw) 'does all the work of patterns for us'. Here's a sample snippet of their work. It's in Java, so beware of the hanging curly braces:
/**
* Searches records.
*/
public void doFind(){
log.debug("Search records");
DCBindingContainer bc = (DCBindingContainer)getBindings();
DCIteratorBinding ib = getBindedIterator(bc,TABLE_ITERATOR);
AdfFacesContext context = AdfFacesContext.getCurrentInstance();
String pScope = context.getProcessScope().get("strAction").toString();
log.debug("Process scope = " + pScope);
if(pScope.equalsIgnoreCase("advanceSearch")){
log.debug("Do advance search");
ViewCriteria vc = ib.getViewCriteria();
Row row = vc.first();
row.refresh(Row.STATUS_INITIALIZED);if(codeFrom.getValue() != null && !codeFrom.getValue().equals("")) { if(codeTo.getValue() != null && !codeTo.getValue().equals("")) { row.setAttribute("ApInvcTypeCode", " between '" + codeFrom.getValue() + "' and '" + codeTo.getValue() + "'"); }else { row.setAttribute("ApInvcTypeCode", " like '" + codeFrom.getValue() + "%'"); } }else{ codeFrom.setValue(null); } if(latinName.getValue()!=null && !latinName.getValue().equals("")){ row.setAttribute("ApInvcTypeLatinName", " like '" + latinName.getValue() + "%'"); }else{ latinName.setValue(null); } if(arabicName.getValue()!=null && !arabicNa
-
One of my proteges[^] is working for a company who swears that the "best" way to do TDD is to write the code first, and then make the test pass AFTER everything has been written. He has pretty much done everything he possibly could to convince the management and his coworkers that they've got it all backwards, but they insist that they don't need to learn anything about patterns since their Oracle Framework (which is a Developer Preview edition, btw) 'does all the work of patterns for us'. Here's a sample snippet of their work. It's in Java, so beware of the hanging curly braces:
/**
* Searches records.
*/
public void doFind(){
log.debug("Search records");
DCBindingContainer bc = (DCBindingContainer)getBindings();
DCIteratorBinding ib = getBindedIterator(bc,TABLE_ITERATOR);
AdfFacesContext context = AdfFacesContext.getCurrentInstance();
String pScope = context.getProcessScope().get("strAction").toString();
log.debug("Process scope = " + pScope);
if(pScope.equalsIgnoreCase("advanceSearch")){
log.debug("Do advance search");
ViewCriteria vc = ib.getViewCriteria();
Row row = vc.first();
row.refresh(Row.STATUS_INITIALIZED);if(codeFrom.getValue() != null && !codeFrom.getValue().equals("")) { if(codeTo.getValue() != null && !codeTo.getValue().equals("")) { row.setAttribute("ApInvcTypeCode", " between '" + codeFrom.getValue() + "' and '" + codeTo.getValue() + "'"); }else { row.setAttribute("ApInvcTypeCode", " like '" + codeFrom.getValue() + "%'"); } }else{ codeFrom.setValue(null); } if(latinName.getValue()!=null && !latinName.getValue().equals("")){ row.setAttribute("ApInvcTypeLatinName", " like '" + latinName.getValue() + "%'"); }else{ latinName.setValue(null); } if(arabicName.getValue()!=null && !arabicNa
Philip Laureano wrote:
The moral of the story: If you're going to outsource to any company, make sure you get some thorough code samples of their work before paying them a cent. Otherwise, you just might end up with a company like this.
*sob* I mentioned something earlier today about perhaps interviewing the new consultants before setting 'em loose on our apps. No such luck. :sigh:
But who is the king of all of these folks?
-
One of my proteges[^] is working for a company who swears that the "best" way to do TDD is to write the code first, and then make the test pass AFTER everything has been written. He has pretty much done everything he possibly could to convince the management and his coworkers that they've got it all backwards, but they insist that they don't need to learn anything about patterns since their Oracle Framework (which is a Developer Preview edition, btw) 'does all the work of patterns for us'. Here's a sample snippet of their work. It's in Java, so beware of the hanging curly braces:
/**
* Searches records.
*/
public void doFind(){
log.debug("Search records");
DCBindingContainer bc = (DCBindingContainer)getBindings();
DCIteratorBinding ib = getBindedIterator(bc,TABLE_ITERATOR);
AdfFacesContext context = AdfFacesContext.getCurrentInstance();
String pScope = context.getProcessScope().get("strAction").toString();
log.debug("Process scope = " + pScope);
if(pScope.equalsIgnoreCase("advanceSearch")){
log.debug("Do advance search");
ViewCriteria vc = ib.getViewCriteria();
Row row = vc.first();
row.refresh(Row.STATUS_INITIALIZED);if(codeFrom.getValue() != null && !codeFrom.getValue().equals("")) { if(codeTo.getValue() != null && !codeTo.getValue().equals("")) { row.setAttribute("ApInvcTypeCode", " between '" + codeFrom.getValue() + "' and '" + codeTo.getValue() + "'"); }else { row.setAttribute("ApInvcTypeCode", " like '" + codeFrom.getValue() + "%'"); } }else{ codeFrom.setValue(null); } if(latinName.getValue()!=null && !latinName.getValue().equals("")){ row.setAttribute("ApInvcTypeLatinName", " like '" + latinName.getValue() + "%'"); }else{ latinName.setValue(null); } if(arabicName.getValue()!=null && !arabicNa