1. 次のクラスは、ユーザー情報の表示と更新の両方を担当しています。結合度/凝集度の観点から、最も適切な改善方針はどれでしょうか?
class UserProfileScreen {
constructor(apiClient) {
this.apiClient = apiClient;
}
async loadUser(userId) {
const user = await this.apiClient.get(`/users/${userId}`);
this.render(user);
}
async updateUser(user) {
await this.apiClient.put(`/users/${user.id}`, user);
this.render(user);
}
render(user) {
// DOMを書き換えてプロフィール画面を描画
}
}
class UserProfileScreen {
constructor(apiClient) {
this.apiClient = apiClient;
}
async loadUser(userId) {
const user = await this.apiClient.get(`/users/${userId}`);
this.render(user);
}
async updateUser(user) {
await this.apiClient.put(`/users/${user.id}`, user);
this.render(user);
}
render(user) {
// DOMを書き換えてプロフィール画面を描画
}
}