18 hours ago · Tech · 0 comments

I think we can perhaps apply one Strategy object as a helper to handle some drawing for us. I love it when a rejected idea contains a kernel of goodness. I still want to get rid of that duplication. It makes me itch. So we’ll be doing a sort of Method Object, which is essentially a kind of Strategy. We’ll pass it our resource, let it load the texture and draw it. I think that since it is focused on drawing, I can’t TDD all of it, but I can TDD the loading bit, which should get us started. I’ll create yet another test file, I guess. I start with this much, because I think I know a lot about what we need here, and there is no point doing silly fake TDD things when this much code can be so close to right: class ContentTexture: def __init__(self, resource): pass class TestMethodObject: def test_create(self): resource = ':resources:images/items/keyRed.png' draw = ContentTexture(resource) I’m not sure what we can actually test here, so I’ll paste in the init that we need and look at it.…

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