Take the 2-minute tour ×
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It's 100% free, no registration required.

I'm wondering, what is the correct punctuation in this sentence:

In OOP, each object contains data and a set of methods, which operate on the data.

I read the rules about restrictive and non-restrictive clauses, but I'm not sure which one is the case here. In my opinion it's supplementary information. Another question is whether comma is needed after "In OOP".

share|improve this question
    
This is a definition, so I suppose that technically it could be considered either restrictive or non-restrictive. But you certainly don't want to use a comma here. You would want to use a comma with "... a set of methods, which usually operate on the data." So I guess that means that definitions should be considered restrictive (unless somebody comes up with a counterexample). –  Peter Shor Jan 29 '13 at 21:20
    
Thank you. But in case of non-restrictive (supplementary) clause, I should put comma there. Why do you suggest to omit it? –  damluar Jan 29 '13 at 21:24
    
Because it sounds better without to me. Why do you say this is supplementary information? If you had a set of methods that didn't operate on the data, it wouldn't count as an object in OOP. I think this means you can make a good case for it being a restrictive clause (and certainly that is the way it should be treated grammatically). –  Peter Shor Jan 29 '13 at 21:26
    
Classes by definition should contain methods that operate on the data, otherwise it's not a good place for them in this class. But I agree, it can be considered also as restrictive clause. Thank you again. –  damluar Jan 29 '13 at 21:37
add comment

3 Answers

up vote 2 down vote accepted

In OOP, each object contains data, and a set of methods that operate on the data.

You could argue either way about whether it's a restrictive clause (we only care about methods that act on the data in this object) or a non-restrictive clause (it's a fact that all the methods operate on the data)*.

When we can argue something like this either way, there is one ultimate authority: The writer. That's you, or for the duration of this answer, that's me. I'm saying it's restrictive, changing to that (not necessary, but it underlines that I'm conveying it as restrictive information), and this lets me help keep "set of methods" with that clause rather than "data and a set of methods".

As does the comma after data. We don't need it there to be valid, but we're allowed it, and it helps the reader know that "operate on the data" only applies to the methods.

The comma after OOP is also optional. Whether we have a pause there or not would depend as much on how it flows with the prior sentences, as anything else.

If the clause about methods where something that could only be understood as non-restrictive, I'd consider rewriting into two sentences.

*I can think of some arguments against that, but that'd be for SO rather than EL&U.

share|improve this answer
1  
I'm not sure you really can argue about whether it's a restrictive clause. What does it mean to postulate some other methods that don't act on the object's data, and which aren't contained within the object either? A restrictive clause would supposedly identify which set of methods we're talking about, but we already know that - they're the ones contained in the object! –  FumbleFingers Jan 30 '13 at 4:06
    
@FumbleFingers in some languages we might have methods that acted upon the object but did not act directly on the data as global methods (though whether they should exist at all, or whether they should be considered functions but not methods is another matter). It's also significant that with good encapsulation a method in another class can act upon an object but not directly upon the data. My main objection to either is that policy classes like comparers give us sound reasons to have methods that don't act upon internal data at all. –  Jon Hanna Jan 30 '13 at 9:56
    
@FumbleFingers Personally I'd have something more like "In OOP, each object contains data, and a set of methods. The data is information about the object's state and access to it is normally restricted so that only that object's methods can act directly upon it." But that's too much a rewrite to really answer the question. –  Jon Hanna Jan 30 '13 at 9:57
    
Personally, I'd just discard the comma and change the data to that data. You probably know more than me about what exactly constitutes a restrictive clause, but it seems to me you could turn it round to "A set of methods which operate on the data are contained within the object" without affecting that categorisation. The highlighted words sure look more like supplementary info about the set of methods, rather than being there to tell us which particular set of methods are being referred to. –  FumbleFingers Jan 30 '13 at 16:46
add comment

I would go for

In OOP, each object contains data and a set of methods which operate on the data.

or even

In OOP, each object contains data, and a set of methods which operate on the data.

share|improve this answer
    
Separating a non-restrictive clause with commas is normal. –  Jon Hanna Jan 29 '13 at 23:22
    
@JonHanna so it is. I have removed my quick judgement. I still feel that a comma after methods, even if treated as a non-restrictive clause, is clumsy and unnecessary but, as you point out, not wrong as such. –  terdon Jan 30 '13 at 14:04
    
I'd be inclined to bend from what is normal for the reason you say though. These comma rules are our servants, not our masters. –  Jon Hanna Jan 30 '13 at 15:22
add comment

"...set of methods, both of which operate on the data."

share|improve this answer
5  
But the data doesn't operate on the data. –  Peter Shor Jan 29 '13 at 21:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.