On my own

Send by email

 Yesterday I was paired up with Ned, a senior programmer and worked on a program to fix a defect with the MTM project.  The defect was that when people searched for products, the type of the inputs they would give wouldn't match up with the type of the request i.g. Strings, booleans, or characters.  To address this defect Ned had me write a function that would take in a string as an input and parse it, taking out all the unnecessary characters such as hash tags, asterisks and anything else that wasn't a period or number.  From there the function would divide the put each parsed string into a list of strings, which is what the function would return.  I started off with Ned by my side walking me through all the necessary files that needed to be created in order for this to actually work, then I was on my own.  At this point google was my best friend.  When google failed me I had two quick access dictionaries right by my side: Himanshu and Grant.  I constantly asked questions about syntax and casting but I still struggled.  In order to check my work, Ned had me write tests for my function to pass.  Each test tested how my function handled different scenarios, such as inputs like "krj kjrg jar 1 ln 2n l3kn" and "1..0.04 13 #### 3l5".  I grew frustrated and took a lunch break.  After, I returned to my project and ended up drawing a diagram on the board of what it did.  By the end of the day I had passed all my test cases but one.  It wasn't until the next morning that I realized I was running the wrong function on one of the lines of code.  Here is my code:

package com.nike.mtm;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class NumberParser {
public List<Double> parseString(String longString) {
     String[] strings = longString.split("[^0-9\\.]");
     List<Double> list = new ArrayList<Double>();
     for (String string : strings) {
          if(!string.equals("") && !string.equals(".")) {
               if (string.indexOf(".")!=-1) {
                    int firstPeriod=string.indexOf(".");
                    int lastPeriod=string.lastIndexOf(".");
                    String result=string;
                         while(firstPeriod!=lastPeriod) {
                              result=String.valueOf(result.subSequence(0, lastPeriod));
                         try {
                              Double d = Double.valueOf(string);
                              } catch (Exception e) {
                                   System.out.println(string);// TODO: handle exception
            return list;
Grant always says wise things to me and gives me advise, but the most influential thing he has said so far is that he loves his job.  He enjoys what he does and isn't afraid to take his work home with him.  You're going to be working for a long time, so make sure you do something you enjoy.