Connascence of Position
Connascence of Position (CoP) occurs when multiple components must be adjacent or must appear in a particular order, often when passed within a positional structure such as an array or a tuple. It is the strongest form of static connascence and must be carefully avoided, especially for higher degrees.
Let's see an example:
public class NotificationSystem { Â Â Â Â public void SendEmail(string recipient, string sender, string message) { Â Â Â Â Â Â Â Â Email email = new Email(); Â Â Â Â Â Â Â Â email.To(recipient); Â Â Â Â Â Â Â Â email.From(sender); Â Â Â Â Â Â Â Â email.Body(message); Â Â Â Â Â Â Â Â _smtpService.SendEmail(email); Â Â Â Â } } _notificationSystem.SendEmail("recipient@email.com", "sender@email.com", "text");
Here...