Quantcast
Channel: User Filip Milovanović - Software Engineering Stack Exchange
Viewing all articles
Browse latest Browse all 182

Comment by Filip Milovanović on Difficulty understanding benefit of Separation of Concerns

$
0
0
And, though you legitimately could, you don't have to stop there. Maybe you want to separate the actual traversal from invoking the action, because you need to use the "getting the next node" functionality in a different context. You separate out that logic by creating an iterator object - a thing that returns, on demand, the next node (or the next element of any structure) according to some order, one by one, until it somehow indicates it's done. Suitable for a while loop. Then you implement your old code in terms of that, and also use this new construct for the other thing you needed it for.

Viewing all articles
Browse latest Browse all 182

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>