I think each solution is indicative of what each of us know and are comfortable with…doesn’t mean that one is better…it’s just what we know.

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christopher Jordan
Sent: Thursday, September 14, 2006 9:37 AM
To: Dallas/Fort Worth ColdFusion User Group Mailing List
Subject: Re: [DFW CFUG] Brain Teaser

 

I typically consider shorter solutions to problems more clever and often times more elegant too. Ken, brought up the dictionary definition of elegant and it mentioned "simple". If regular expressions are easy for one person to read because they're very comfortable with them and they think in regular expressions, then I'd agree that it's more simple. More elegant. For other folks (like me, unfortunately), who have to pull out the regular _expression_ pocket guide every time they run into  all but the very simplest of regular expressions (and sometimes even the really simple ones), the slightly longer four or five line solution seems simpler, and therefore more elegant.

What about that? Agree? Disagree? :)

Chris

Marlon Moyer wrote:

 

On 9/14/06, Daniel Eben Elmore <[EMAIL PROTECTED]> wrote:

@Rick
Yes elegance requires interpretation. I find it interesting that everyone
interpreted it to mean "one line of code". Who taught you that??


I don't think that there's a standard to how many lines of code an 'elegant' solution would contain, but why can't a 1 line solution be elegant.

 

@Marlon
"the more code you have, the higher the chance of bugs."
That's a straw man argument.


example of a straw man argument:

Daniel: A one liner solution probably isn't elegant.
Marlon: Writing hundreds a lines of code would be silly.

 


"struggle in the little company I work for as to when oop goes too far"
OOP is objects taking to each other. Are you sure your doing OOP? And not
quasi-OOP (procedural code dumped into objects).


Are you sure you're programming in CF which at the very  most is a quasi-OOP language?

 

@the UDF advocates
Yes, this is better. The code inside the function needs to be
readable/maintainable too. If you're just going to use it as a wrapper for
one of your "elegent" one liners, there's not much point.


Do you have a problem reading mine?  It's two standard CF functions that happen to appear in 1 line. I know a lot of people have a hard time with regular expressions,  but does that preclude the use of them in "elegant" code?

 

@everyone
"an object would be overkill"
Famous last words! :)


In a  more OO language, I would agree with you, but in the case of CF, I still think it would be overkill.

 

I wish I had more time to debate. I think I'll start trying to come to the
meetings again!

-Daniel Elmore



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
On Behalf Of Anthony Frey
Sent: Wednesday, September 13, 2006 10:48 PM
To: Dallas/Fort Worth ColdFusion User Group Mailing List
Subject: Re: [DFW CFUG] Brain Teaser

not one liner, not elegent, just different.
It does take into account that it may be the only param though.
anyway, it took my mind off this jsp crap ive been doing all day, thanks!

<cfset params = right(cgi.HTTP_REFERER, find("?", cgi.HTTP_REFERER, 0)+1)>
<cfloop list="#params#" delimiters="&" index="i">
<cfif find("numPageID", i) GTE 1>
  <cfoutput>
   #getToken(i, 2, "=")#
  </cfoutput>
</cfif>
</cfloop>



Anthony C. Frey
214-529-1507
[EMAIL PROTECTED]




----- Original Message ----
From: Joe Kelly <[EMAIL PROTECTED]>
To: Dallas/Fort Worth ColdFusion User Group Mailing List
< [email protected]>
Sent: Wednesday, September 13, 2006 4:34:56 PM
Subject: [DFW CFUG] Brain Teaser


I want to see if someone can come up with a more elegant solution to
this problem.

Given:
CGI.HTTP_REFERER will always have a URL variable, "numPageID=xxx"
which is numeric and could be any size number.
The HTTP_REFERER may or may not have other URL variables in any order,
which could be alphanumeric or numeric
The current template needs to pull the value of the "numPageID" URL
variable out of the CGI.HTTP_REFERER

I'll show my solution in another post so as not to spoil anyone's view
on this problem, not saying that mine is best, of course!

Thanks,
Joe Kelly

_______________________________________________
Reply to DFWCFUG:
  [email protected]
Subscribe/Unsubscribe:
   http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
    http://www.mail-archive.com/list%40list.dfwcfug.org/
   http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
  www.HostMySite.com
  www.teksystems.com/

_______________________________________________
Reply to DFWCFUG:
  [email protected]
Subscribe/Unsubscribe:
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
    http://www.mail-archive.com/list%40list.dfwcfug.org/
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
  www.HostMySite.com
  www.teksystems.com/


_______________________________________________
Reply to DFWCFUG:
  [email protected]
Subscribe/Unsubscribe:
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
    http://www.mail-archive.com/list%40list.dfwcfug.org/
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
  www.HostMySite.com
  www.teksystems.com/




--
Marlon


 


 
_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.HostMySite.com 
  www.teksystems.com/
  
_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.HostMySite.com 
  www.teksystems.com/

Reply via email to