Class Book
{
private int year;
private String session;
private int volume;
private int number;
private String khand;
private Date proceeding_date;
private int pageNo;
Book(year,session,volume)
{
$this.year=year;
$this.session=session;
$this.volume=volume;
}
public getBookName()
{
return (year+session+volume) //concatenation of three
}
}
Book b1=new Book(1952,abc,123);
Suppose my requirements change and now the creation of book also include the proceeding_date
in the constructor parameters,
after code is compiled I am allowed to make changes in the class or there is a design flaw?
The class should be designed so that it will accept any changes in future, how I fit the OOAD principle in my design, did my class follow SRP, open/closed principle.
Suppose there is requirement to add more private variable in class will it break the open/closed principle? Is added new members [variables/methods] in a class breaks the OCP?