Initializing object by settings implemented as a class Here is the story.

We have the BankTerminalSettings class. 

It has many properties:

public class BankTerminalSettings {
    public bool IsEnabled { get; set; }
    public string IPAddress {get; set;}
    public ushort TcpPort {get; set; }
    public List&lt;string&gt; Zombies {get; set;}

    //and many other properties
}


And we have a class which takes BankTerminalSettings as a parameter of it's constructor.

public class BankTerminal {
    public BankTerminal(BankTerminalSettings terminal, int clientId) {
        ValidateBankTerminalSettings(terminal);

        terminalSettings = terminal;
        this.clientId = clientId;
    }
}


The thing is that the BankTerminal uses only three of all those properties in that domain config class named BankTerminalSettings.
It's a temptation just to pass the whole instace of the BankTerminalSettings, but the caller can incidentally change those properties which are relevant for the BankTerminal. That can cause very subtle bugs.

What would you recommend?
To replicate the BankTerminalSettings before passing it's instance?
To replicate the BankTerminalSettings in the constructor of the BankTerminal?
To pass only those parameters which are truely needed by the BankTerminal?
It depends on whether you want to handle config updates or not. In your case I guess you just want to work with data at constructing point. There are few options to do this:


Make copy of your settings before they are passed and use BankTerminalSettings inside the BankTerminal (as was considered). But personally I dont like the idea there are different BankTerminalSettings passing around.
Better approach would be just to inialize your internal fields with config settings, i.e. to copy settings of BankTerminalSettings to BankTerminal


Also I'm worried with the fact BankTerminalSettings contain more properties than is needed for BankTerminal. Maybe BankTerminalSettings should get another name? Anyway, I would create interface IBankTerminalSettings that contain only properties needed by BankTerminal and pass it to BankTerminal constructor