Skip to content

OCP refactoring#6

Open
forshtreter wants to merge 1 commit intoazproduction:gh-pagesfrom
forshtreter:ocp_refactoring
Open

OCP refactoring#6
forshtreter wants to merge 1 commit intoazproduction:gh-pagesfrom
forshtreter:ocp_refactoring

Conversation

@forshtreter
Copy link

forshtreter@ & frgt@

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно было совсем избавиться от AnswerType. И вместо Question сделать 2 класса:

var questions = [
    new QuestionChoice('НЛО?', ['Да', 'Неа']),
    new QuestionInput('Два+Два?')
];

Оба они могли иметь интерфейс IDomRender:

{
    /**
     * @retrun {HTMLElement}
     */
    render: function () {}
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в целом идея таже самая ведь, думали просто что question может не только рендерить, а что-от еще делать.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну он и так сможет что-то делать. Он же имплементирует интерфейс, а не наследуется от класса.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants