Tuesday, March 23, 2010
I woke up today at 4:30 AM and started to write code. I think I fixed the issues I mentioned in my last post regarding excessive abstraction. I also installed EclEmma and got that working. I already feel a little bit better, knowing that I don't have to waste time making sure I'm testing all my public methods. I just run EclEmma and it highlights tested code green, and untested code ends up being red. I can tell already that I'm going to like it. I think it will take me a few more days before I have a working color display using all the tested code that I've been writing, as long as using interfaces and such with easily-interchangeable renderers and such. (one renderer will handle the standard color-char displays, while another will deal with formatted text)
Question: On rec.roguelike.dev, I've seen some talk about using Dictionaries and the keyword/value pairs as a container for display or whatever. This intrigues me because I've been using this object quite a bit at work, and I'd like for the size of my display object to be able to dynamically size. (I wouldn't necessarily need to clear out unused key-value pairs, unless it was a memory issue). Basically, the display would have key value pairs for each character that had been added to the display, and it would also have a range of what to display, if a user were to zoom in, the range would shrink, the individual cells would enlarge, and fewer of the key-value pairs would need to be updated each refresh. If a user zoomed out, the cells would shrink and the range would expand, and more key-value pairs would need to be added/refreshed.
I suppose the same thing could be accomplished by just creating a 2d array with the maximum size that would be used if the level were zoomed all the way out, and still use the min/max range values to control what is getting updated and displayed; mostly I was just intrigued by key-value pairs.
Also, I ate spaghetti for breakfast.
Sunday, March 21, 2010
So, I've really been digging abstraction and interfaces lately. I'm like, "Hmm, I'll probably want more than one way to do this in the future, so I'll abstract that bit out so I can inject the dependency or whatever." Because I've been so focused on writing tests lately, I wasted a few hours today. I got to this point where I was confused as to which Interface/class I was injecting into another class, and I realized I'd abstracted the same thing about three levels deep. I kept being like, "I'll handle it with this next abstraction," but I never actually was like, "The buck stops here."
Anyway, just a bit of frustration, mostly because I felt so productive yesterday and most of my coding today seemed for naught. Though, I think I learned a valuable lesson about making sure I don't lose sight of the bigger picture.
I think I'll start using EclEmma pretty soon to help keep track of what I'm doing with my tests.
Saturday, March 20, 2010
I'm curious if anyone reading this has any experience with writing tests in Eclipse. I've been using Junit, and like it mostly. I find it helpful that I can create a new testing class and specify which already-existing class is to be tested; (and that it automatically populates the test class with all the public methods.) I try to make sure I have all my public methods under test, but I know that sometimes I create a public method and then forget to add it to the testing class. Is there a way to, say, update a testing class so that it will re-populate, adding any uncovered public methods? I suppose I could look into some sort of test coverage plugin.
My current focus is re-getting the display portion of my game up and running. I think I'm pretty close, though when it's there, I won't really have anything to show for it, other than a testing suite with all green checks. (Though, I should be able to create a window and display some dummy information)
Some things that are on my short list to implement: dynamic resizing of the window, zooming in and out using the scroll wheel, etc.
Wednesday, March 17, 2010
A lot has happened since the last time I posted:
1) I graduated from Eastern Michigan University cum laude
2) My grandpa died during exam week, and I was able to thank him for his generous contributions towards my college expenses, assure him I'd graduate, and that I had some job interviews lined up.
3) I amazingly got a job after only a few phone interviews and 2 in-person interviews. The people I work with are pretty amazing and I've been employed since January 11th. I'm only just now starting to feel like I'm getting the hang of it; though I'm still learning so much every day.
4) I grew frustrated with being so exhausted in the evenings. I stopped working out, I subscribed to too many shows on Hulu. I brewed a few batches of beer
5) I became interested in test-driven development, while at the same time realizing that my x-com codebase had again grown very unmanageable.
6) I created an account at git-hub and set up gitgui with my eclipse install
7) I started rehashing my game using TDD. The going is slow, but I think it's very worthwhile.
8) I somehow borked my git-hub security hash. (I still need to fix this)
9) I started working and running again.
This is it for now. I'm still around, I still read rec.roguelike.dev, I'm still working on my game. It's just taking me a while to adjust to having a career job.