Search code examples
javaoopstruts2programming-languagessemantics

What does it mean to "code against" or "resolve against" something?


I've been reading a lot of computer science books and articles and I keep seeing the phrase "code against." For example, in the book Struts 2 in Action by Donald Brown, Chad Michael Davis, and Scott Stanlick, the following sentences can be found:

  • "Although it’s possible to write web applications by directly coding against the Servlet API, this is generally not considered a good practice."

  • "This means that Java developers can write HTTP server code against an intuitive object-oriented abstraction of the HTTP client/server communications."

In this book, particularly, there were a lot of instances of the use of the phrase "resolve against," as well. For example:

  • "When the framework invokes the result, your JSP page data access will be resolved against the old object."

  • "The ValueStack represents the data model exposed to the current request and is the default object against which all OGNL expressions are resolved."

  • "If no namespace attribute is specified, then the action is resolved against the namespace of the current request."

I guess my confusion is based around the word "against." How and why is it used in this programming concept? I wouldn't think you'd want to code against something; rather, I'd think you'd want to code in correspondence with it. This could just be the author's phraseology, but can anyone help me out?


Solution

  • "against" is not used here as "in oposition" but rather as "supported by", "backed up by", "provided by", "based on". One of the accepted meanings of the word "against" (Oxford dictionary) is

    In or into physical contact with (something), typically so as to be supported by or collide with it

    Of course, the "support" that the API (or whatever) gives you is not physical here :-)