Boolean arguments are very hard to read, and thus difficult to maintain. The main problem is that the purpose is generally clear when you read the method signature where the argument is named. However, naming a parameter is generally not required in most languages. So you will have anti-patterns like RSACryptoServiceProvider#encrypt(Byte[], Boolean) where the callboolean parameter determines what kind of encryption is to be used in the function.
where the reader has to lookup the method's signature simply to determine what the hell true could actually meansmean. Passing an integer is of course just as bad:
would tell you just as much (or- or rather: just as little). Even if you define constants to be used for the integer then users of the function may simply ignore them and keep using literal values.
Booleans can only have two values. This means that if you have a third option, then you'd have to refactor your signature. Generally this cannot be done because ofeasily performed if backwards compatibility is an issue, so you'd have to extend any public class with another public method. This is what Microsoft finally did when they introduced RSACryptoServiceProvider#encrypt(Byte[], RSAEncryptionPadding) where they used an enumeration (or at least a class mimicking an enumeration) instead of a boolean.
It may even be easier to use a full object or interface as parameter, in case the parameter itself needs to be parameterized. In the above example you could imagine that you would have an OAEP padding parameter that itself cancould be configuredparameterized with the hash value to use internally. Note that there are now 6 SHA-2 hash algorithms and 4 SHA-3 hash algorithms, so the number of enumeration values may explode if you only use a single enum as aboveenumeration rather than parameters (this is possibly the next thing Microsoft is going to find out).
Boolean parameters may also indicate that the method or class is not designed well. For instance, about every otherAs with the example above: any cryptographic library other than the .NET one doesn't use a padding flag in the method signature at all.
Determining the padding is something that is performed during creation or initialization of the class instance. That way the code can fail before a padding algorithm is chosen. For instance, many RSA keys on smart cards only support one of the two padding mechanisms. So you could create the provider and only find out that the mechanism is not supported when you'd perform the actual encryption or decryption. The underlying philosophy is called fail-fast.
Almost all software gurus that I like warn against boolean arguments. For instance, Joshua Bloch warns against them in the highly appreciated book "Effective Java". In general they should simply not be used. You could argue that they could be used if the case that there is one parameter that is easy to understand. But even then: Bit.set(Booleanboolean) is probably better implemented using two methods: Bit.set() and Bit.unset().