1 hour ago · 6 min read1144 words · Tech · hide · 0 comments

Hello, loves! Sweet little idea … I have one. Very small but I think it’ll make things just a bit nicer. We’ll see. I’ve been improving the code both in the last few articles and sometimes when you weren’t watching. If there has been a theme to the work, it has been to move responsibility for things to the places where they seem to fit better. Something something cohesion. I know—or used to know—all that theory, but these days I follow much simpler practices, removing duplication, observing Feature Envy and moving code to the class we’ve been fondling a bit too much, and so on. Much of what I’ve done the past few days has added capability to Cell class. I think it’s worth mentioning how that works, since a Cell knows essentially nothing: class Cell: def __init__(self, x, y): self._xy = (x,y) A Cell is just a tuple with delusions of grandeur, because it can do many things. Its methods include add_content, attempt_move, available_neighbors, can_move_to, center_position, contents,…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.