Nov. 19th, 2008

tcepsa: (Computation Suspended)
I've discovered a situation that would be made significantly less cumbersome if I could have an array of function pointers, loop over the array, and only have to write the setup and teardown code once around the call to the current function being pointed to with the same arguments every time.

While superficially it might seem that my claim to have leveled up is inaccurate because I've been chucking around references to functions for years (primarily in Javascript callbacks), this is one of the first times I can think of needing them to do something proactive instead of reactive. But I'm constrained to programming in Java for this assignment (and it already had 20+ hours of work in it by the time that I'd realized I wanted function pointers) so I had to triplicate my code instead (once surrounding each of the three core function calls).

Still, I take it as an encouraging indicator of the direction in which my thinking is trending that I recognized that they _would_ have been useful here ^_^

(I probably could have done something approaching that with JUnit, but I would have had to split the code up in ways that seem awkward to me and may not have been familiar to the grader, and I wasn't up for that...)

(I also probably could have done something with aspect-oriented programming, but that would be getting WAY too involved for this project, especially since I'm relatively unfamiliar with that paradigm in general and its implementations in specific)

Profile

tcepsa: (Default)
tcepsa

April 2015

S M T W T F S
   12 34
567891011
12131415161718
19202122232425
2627282930  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 29th, 2025 08:48 am
Powered by Dreamwidth Studios