Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I have an Interpreter class that has a method named loop. This method takes two inputs, a java.io.Reader and a java.io.Writer. Until Reader provides input, it is read, evaluated, and printed to Writer.

For some reason loop does not sound like a good name for this method. I thought of repl but that doesn't sound too good either. What would be a better name for it?

share|improve this question
1  
Maybe: process –  palacsint Nov 1 '12 at 14:22
    
Could you name it more along the lines of the functionality it is doing rather than the steps it is taking to achieve the result? –  dreza Nov 2 '12 at 8:37
    
@palacsint, I have already used that one for something else. :( –  missingfaktor Nov 2 '12 at 9:04
    
@dreza, it's decoupled from those bits. –  missingfaktor Nov 2 '12 at 9:04

2 Answers 2

process is possible but a little arbitrary for my taste.

A better option would be pipeAndProcess

I'd just name it readEvalWrite

share|improve this answer
    
Thank you for the suggestion! I ended up going for a interact, inspired by the function with same name and similar functionality from Haskell stdlib. –  missingfaktor Nov 2 '12 at 9:03
    
+1 for readEvalWrite. It helps people who look at your code in the future to name things in a similar fashion as to what they are meant do. –  Corv1nus Nov 2 '12 at 13:21

I'd call it readEvaluatePrintLoop, which is the long form of repl. Or even repl ... on the basis that the reader ought to recognize the term and understand what it means.

share|improve this answer
    
Thank you for the suggestion! I ended up going for a interact, inspired by the function with same name and similar functionality from Haskell stdlib. –  missingfaktor Nov 2 '12 at 9:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.