Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. A "New" Way to practice TDD

A "New" Way to practice TDD

Scheduled Pinned Locked Moved The Weird and The Wonderful
javaoraclecomtestingdebugging
3 Posts 3 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Philip Laureano
    wrote on last edited by
    #1

    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
    
    S R 2 Replies Last reply
    0
    • P Philip Laureano

      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
      
      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • P Philip Laureano

        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
        
        R Offline
        R Offline
        Ray Cassick
        wrote on last edited by
        #3

        Tell him that if it was supposed to be that way they would have called it Development Driven Test (DDT) instead :)


        FFRF[^]


        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups