Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

shitting up /prog/ -- interfaces

Name: Anonymous 2010-08-03 18:05

Sorry to do this to you /prog/ but I have an actual programming question about interfaces. If any advice trickles in between anus haxing and toy language remarks, I'd really appreciate it.

I have a script that controls an instrument. At one level are the scheme functions that sit on top of a very, very basic C library, and some aggregation/helper functions on top of that. The instrument has some one huge global state vector which contains the relevant information from the instrument (data + some other crap). Instead of memorizing the structure of this vector, I macro'd up some getter and setter functions.

So, everything is great. 99% of the time, the interface allows for some concise expressions. A custom macro let's me describe data collection in one line "in the language of the problem." Lovely.

But this one damn experiment requires some really dirty data access. I have to collect almost all the results from the getter functions and pass them along all the way through something not entirely unlike method chaining. Well, in practice, what this means is that on the other side of the interface I'm basically recreating the fucking data structure the interface was meant to hide.

How would you handle this situation? Would you push some of these otherwise unused functions back into the interface? Just leave it as it is like some shitty edge case? I feel like a sepples weenie going through all the trouble of creating an abstraction only to try to circumvent the abstraction later.

Name: Anonymous 2010-08-04 3:11

The way XML solves this problem is through two separate technologies, DOM and SAX. I suggest you look in to this.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List