jwcolby
jwcolby at colbyconsulting.com
Thu Jan 28 07:15:06 CST 2010
> I dont agree that you need a hammer aka class to solve every programming task. LOL, I don't remember ever saying that. A class is a tool in my toolbox, nothing more. And yes I am fluent and comfortable with them. John W. Colby www.ColbyConsulting.com Max Wanadoo wrote: > My lazy code took 2 mins. > I didnt mind doing it because it was for somebody else - therefore 2 > mins well spent. > If I was doing it for myself I would have paramatised it. > Familiarity with classes, like other thinks, does bring its own reward > in terms of speed and efficiency - agree with you there. > I dont agree that you need a hammer aka class to solve every programming task. > > max > > > On 28/01/2010, jwcolby <jwcolby at colbyconsulting.com> wrote: >> > Yes John/Drew but why use that horrendous code when you can do the same >> with this.. >> >> The answer of course is that horrendous code is only horrendous code if you >> can't knock it out in 2 >> minutes. It takes me about 5 minutes longer to do a generic solution that >> can handle this same >> requirement than it takes you to do the one liner that only handles this one >> specific solution. >> >> Why? Because I am comfortable with classes. >> >> How did I get that way? By USING THEM! >> >> ;) >> >> I actually USE a generic solution to this exact problem in many different >> places. Having name / >> value strings like this is not something that was invented by the >> application under discussion, it >> is EVERYWHERE! And it is often the case that you want to know not just the >> one value but every value. >> >> So recode your one liner over and over if you wish. I have a class pair in >> my framework that does >> this for me. >> >> As for your "generic solution"... it does not handle key/value strings of >> variable length. You have >> hard coded 0 to 3. It does not handle getting a specific key value pair, it >> looks for a specific value. >> >> You have gone to a lot of work for a solution that is good for exactly and >> only one specific >> instance, when 5 minutes more work would have handled the whole enchilada. >> >> I call that lazy programming. JMOOC. >> >> Doing it the right way is so trivial an exercise that it seems incredible >> that you would argue the >> point. >> >> John W. Colby >> www.ColbyConsulting.com >> >> >> Max Wanadoo wrote: >>> Yes John/Drew but why use that horrendous code when you can do the same >>> with >>> this.. >>> >>> Call >>> xsplit("[AccountNo]=1234,[InvoiceNo]=1234567,[InvoiceDate]=04/01/2010,[Name] >>> =Barry") >>> >>> Function xSplit(str as string) >>> Dim arr() As String, i As Integer >>> arr = Split(str, ",") >>> Debug.Print arr(0), arr(1), arr(2), arr(3) 'Done! >>> 'if you want the values then this next bit will do that >>> For i = 0 To 3 >>> arr(i) = Mid(arr(i), InStr(arr(i), "=") + 1) >>> Debug.Print arr(i), >>> Next i >>> End Function >>> >>> A person cannot go through life taking the more obtuse form of coding just >>> so that they may "learn" something new. >>> It is all about getting the code out. >>> I am with Stuart on this. >>> >>> Max >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >>