Anthony Williams | 1 Feb 2005 10:57
X-Face
Picon
Favicon

Re: refactoring in generating dynamic SQL


"Ramon Leon" <rleon <at> insario.com> writes:

> Yes, very much the same as I suggested.  I'm curious how long you used
> this, and how you feel it worked for you?  

I developed this probably about 6-9 months before I left the company, and
found it invaluable during that time. Like I said, it enabled us to implement
the custom search facility, and to change and extend the database schema.

> I haven't been using mine for
> very long and I'd be very interested in a more detailed response of any
> issues or shortcomings found in a production system using this approach.

The difficulty I found was getting the joins right for "OR" scenarios --- you
might need the same table joined multiple times, possibly with outer joins.

> I wrote mine mostly for fun and learning about interpreters, but I'm
> liking it enough that I may flush it out a bit and make it production
> ready.  

I liked it, and I'd do it that way again. Retrospectively I prefer it to the
other SQL framework I wrote at around the same time, which accepted
pre-written SQL statements, and worked out what the columns and data types
were for input and output; it was a nice framework, but you still needed to
specify the SQL. It would have worked as a backend for the first approach, but
as it happens the former framework was in Java, and the latter in C++.

Anthony
--

-- 
(Continue reading)

rjpeff | 5 Feb 2005 12:17

Refactoring input and criticism apprecaited please...


Dear all,

I am setting up a refactoring information site to assist some of my students.  Since I 
will put some effort into this, I might as well try for something that industrial people 
can use too.  So, if you can find the time, I would appreciate any advice as to what to 
add and/or change to the following site:  

www.refactoring.info

Since this is just an information repository, please do not ask me to promote your 
product, commercial service, or book.  Information should be unbiased, not trying to 
sell something.

Further, please recommend changes in a constructive manner:  if something "sucks" 
or "smells" then please tell me how you would correct it.  

Email is better than posting on this site - so please contact me at refactor <at> peff.info 
or refactor <at> sunitia.com

Thanks.  Yours, Rob

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/refactoring/

<*> To unsubscribe from this group, send an email to:
    refactoring-unsubscribe <at> yahoogroups.com
(Continue reading)

Santiago Valdarrama | 7 Feb 2005 02:11
Picon

"Enhance Iteration" and "Decline Iteration" (continuation...)


Decline Iteration
-----------------

You are iterating over a collection or array using the enhanced for
loop, and you need to have access to the iterator or index variable in
order to make some operation with it.

Replace the for-each construct with a classic for loop. 

int locate(int[] values, int value) {
    int index = 0;
    for(int v : values) {
	if (v == value) {
            return index;
	}
        index++;
    }
    return -1;
}

  	           | |
                           | |
                         \ | | /
                           \ /

int locate(int[] values, int value) {
    for(int index = 0; index < values.length; index++) {
        if (values[index] == value) {
            return index;
(Continue reading)

Santiago Valdarrama | 7 Feb 2005 02:10
Picon

"Enhance Iteration" and "Decline Iteration"


In this message, I present to the refactoring community two new refactorings.

Please, send me your comments about them.

Thanks,

Santiago Valdarrama.

*****************************************************

Enhance Iteration
-----------------

You are iterating over a collection or array in a ugly old manner.

Replace the iteration code with a for-each loop.

void process(Collection<Process> processes) {
    for (Iterator<Process> p = processes.iterator(); processes.hasNext();) {
        processes.next().process();
    }
}

	           | |
                           | |
                         \ | | /
                           \ /

void process(Collection<Process> processes) {
(Continue reading)

richard.hansen | 7 Feb 2005 14:51
Picon

RE: "Enhance Iteration" and "Decline Iteration"


I guess I have always viewed refactor as language independent. Sure, we generally assume object oriented
development, but I don't think refactorings are about language specific features such as a "for each" loop.

> -----Original Message-----
> From: Santiago Valdarrama [mailto:svpino <at> gmail.com]
> Sent: Sunday, February 06, 2005 7:10 PM
> To: refactoring <at> yahoogroups.com
> Subject: [refactoring] "Enhance Iteration" and "Decline Iteration"
> 
> 
> 
> 
> In this message, I present to the refactoring community two 
> new refactorings.
> 
> Please, send me your comments about them.
> 
> Thanks,
> 
> Santiago Valdarrama.
> 
> *****************************************************
> 
> Enhance Iteration
> -----------------
> 
> You are iterating over a collection or array in a ugly old manner.
> 
> Replace the iteration code with a for-each loop.
(Continue reading)

Dagfinn Reiersøl | 7 Feb 2005 15:22
Picon
Picon

Re: "Enhance Iteration" and "Decline Iteration"


richard.hansen <at> thomson.com wrote:

>I guess I have always viewed refactor as language independent. Sure, we generally assume object oriented
development, but I don't think refactorings are about language specific features such as a "for each" loop.
>  
>
There are examples of classic refactorings that are more or less 
language-dependent. Encapsulate Downcast is meaningless in dynamically 
typed languages. Replace Error Code with Exception and Replace Exception 
with Test are irrelevant in languages that lack exception handling.

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/refactoring/

<*> To unsubscribe from this group, send an email to:
    refactoring-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

cnk02 | 7 Feb 2005 21:05
Picon
Favicon

visitor pattern


Hi,
I am trying to find various real design problems
where the visitor pattern can be applied
the most relevant place, I have found,
is in parsing the syntax tree in a compiler.
I will be glad if anybody can give me any valuable information.

Thanks.

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/refactoring/

<*> To unsubscribe from this group, send an email to:
    refactoring-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

yahoogroups | 8 Feb 2005 03:08

Re: visitor pattern


From: "cnk02" <cnk02.at.yahoo.com <at> yahoogroups.at.jhrothjr.com>
To: "refactoring <at> yahoogroups.com" 
<refactoring.at.yahoogroups.com <at> yahoogroups.at.jhrothjr.com>
Sent: Monday, February 07, 2005 2:05 PM
Subject: [refactoring] visitor pattern

>
>
>
> Hi,
> I am trying to find various real design problems
> where the visitor pattern can be applied
> the most relevant place, I have found,
> is in parsing the syntax tree in a compiler.
> I will be glad if anybody can give me any valuable information.

The place where it just popped out at me
was in a bunch of scripts that was processing
directory trees to do moderately complex
file conversions. I was practicing removing
duplication when I asked the question: how
would I remove a duplicated for statement?
Voila! Visitor pattern in all its glory.

John Roth

>
> Thanks.
>
(Continue reading)

Dagfinn Reiersøl | 8 Feb 2005 09:59
Picon
Picon

Re: visitor pattern


You might be interested in this:

http://www.butunclebob.com/ArticleS.UncleBob.IuseVisitor

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/refactoring/

<*> To unsubscribe from this group, send an email to:
    refactoring-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Markus Silpala | 8 Feb 2005 01:56
Favicon

Re: "Enhance Iteration" and "Decline Iteration"


On Feb 7, 2005, at 8:22 AM, Dagfinn Reiersøl wrote:
>
> richard.hansen <at> thomson.com wrote:
>
>> I guess I have always viewed refactor as language independent. Sure, 
>> we generally assume object oriented development, but I don't think 
>> refactorings are about language specific features such as a "for 
>> each" loop.
>>
>>
> There are examples of classic refactorings that are more or less
> language-dependent. Encapsulate Downcast is meaningless in dynamically
> typed languages. Replace Error Code with Exception and Replace 
> Exception
> with Test are irrelevant in languages that lack exception handling.

I can see value in language-specific refactorings, but I do question 
whether these two might be too idiomatic (essentially, too small) to 
justify cataloging. Then again, if something as basic as Rename 
Variable gets its own entry, then changing iteration styles ought to be 
fair game as well. They are common and useful enough that people should 
probably know about them.

Still, if the community were to adopt these two I would like to see 
them wearing more descriptive names. Perhaps "Replace Indexed Loop with 
For-Each Loop" and "Replace For-Each Loop with Indexed Loop?" Enhance 
and Decline by themselves don't tell me very much about the actual 
refactorings.

(Continue reading)


Gmane