Aaron Rubinstein wrote:
>
>> Given just the idea of the data, can you improve on that?
> 
> I bet I could!

I bet you could too :)

> It's interesting how my instinct, when trying to develop a programming 
> solution, is to wrestle with the problem inside the context of the language. 
> As a result, the solutions I come up with tend to be shaped by my limited 
> understanding of that language. I think you're right that this is a case of
> fluency, that I am fluent in English and my best problem solving skills are
> most likely in that context. Trying to solve the problem in Perl, I'm likely
> not using my best skills and thus come up with a poor solution.

It's a frequent assumption that when you working with a tool of any sort,
whether it's a knife and fork or a golf club, that you should work with that
tool until you are proficient. But unless those tools are prescribed by the
rules of the game in play then you should consider alternatives. I often eat
from a ladle or wooden spoon when I am cooking, but etiquette says that I may
not do the same at table; and getting a ball into a hole half a mile away by
hitting it with a stick is not a good solution by any standards.

More often than not, a programming language restricts what you can do over what
you can describe using English, and while you can always get more out of any
language by becoming familiar with it, you are usually becoming familiar with
what is impossible or difficult rather than getting used to new exciting
possibilities.

> I also take from your advice, whether you meant it or not, that I should
> approach my code as if it would be scalable.  My solution is probably
> adequate for a small scale problem but its silliness would quickly be
> exposed as soon as the data scaled up.

Never write off your solution as silly. If it works then it is a solution, and
final solutions are almost never the best ones possible.

I meant quite the opposite about scalability. My intention was to emphasize that
the amount of data changes what is a good solution. It is a useful exercise to
imagine that the data is printed on sheets of paper and that you have to solve
the problem manually given just an aircraft hangar full of filing cabinets. If
you have only a couple of sheets of paper with a single line printed on each,
then you can just sit at your desk and write the output. But if you have several
stacks of paper then you might want to start using the filing system.

> Thanks for the advice and inspiration.

You're more than welcome. Remember that the best way to solve a problem, whether
it's a programming problem or any other sort, is to think about whether it's
comparable to any situation you have already come across. It's called
abstraction and it's your friend :)

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to