当前位置: 首页 > news >正文

做网站柳州网站原型设计和版式设计

做网站柳州,网站原型设计和版式设计,しょうじょ少女直播,咸阳网站开发公司地址人工智能在建筑运营构建API时#xff0c;您应始终考虑谁将使用它。 当API简单易用时#xff0c;用户就会感到满意。 当用户满意时#xff0c;每个人也都会满意。 但是出色的可用性并非总是容易实现的。 有一些模式对此有所帮助#xff0c;在这篇文章中#xff0c;我将重点… 人工智能在建筑运营 构建API时您应始终考虑谁将使用它。 当API简单易用时用户就会感到满意。 当用户满意时每个人也都会满意。 但是出色的可用性并非总是容易实现的。 有一些模式对此有所帮助在这篇文章中我将重点介绍经典的构建器模式以及如何使用步进构建器模式对其进行增强以构建没有大脑接口易于使用且不会出错的对象 。 因此让我们开始绘制一些上下文我们有2个域对象代表连接到某个远程或本地服务器的用户配置。 当需要远程凭据时在本地时。 package com.marco.sbp; public class UserConfiguration {private final String name;private ServerDetails serverDetails;public UserConfiguration(String name) {this.name name;}public void setServerDetails(ServerDetails serverDetails) {this.serverDetails serverDetails;}public String getName() {return name;}public ServerDetails getServerDetails() {return serverDetails;} }package com.marco.sbp; public class ServerDetails {private final String host;private String user;private String password;public ServerDetails(String host) {this.host host;}public void setUser(String user) {this.user user;}public void setPassword(String password) {this.password password;}public String getHost() {return host;}public String getUser() {return user;}public String getPassword() {return password;} } 我们想要使用两种不同的技术经典构建器模式和步骤构建器模式来抽象上述对象的构造。 经典的构建器模式非常简单它使用诸如onLocalHostonRemoteHost等正确命名的方法来掩盖UserConfiguration和ServerDetails的创建。 package com.marco.sbp.builder; import com.marco.sbp.ServerDetails; import com.marco.sbp.UserConfiguration; public class ClassicBuilder {private String name;private String host;private String user;private String password;public ClassicBuilder(String name){this.name name;}public ClassicBuilder onLocalHost(){this.host localhost;return this;}public ClassicBuilder onRemoteHost(String remoteHost){this.host remoteHost;return this;}public ClassicBuilder credentials(String user, String password){this.user user;this.password password;return this;}public UserConfiguration build(){UserConfiguration userConfiguration new UserConfiguration(name);ServerDetails serverDetails new ServerDetails(host);serverDetails.setUser(user);serverDetails.setPassword(password);                    userConfiguration.setServerDetails(serverDetails);return userConfiguration;} } 步骤构建器模式仍在使用智能名称来构造对象但仅在需要使用接口和适当的封装时才公开这些方法。 package com.marco.sbp.builder; import com.marco.sbp.ServerDetails; import com.marco.sbp.UserConfiguration;/** Step Builder */ public class StepBuilder {public static NameStep newBuilder() {return new Steps();}private StepBuilder() {}public static interface NameStep {/*** param name*            unique identifier for this User Configuration* return ServerStep*/ServerStep name(String name);}       public static interface ServerStep {/*** The hostname of the server where the User Configuration file is stored will be set to localhost.* * return BuildStep*/public BuildStep onLocalhost();/*** The hostname of the server where the User Configuration file is stored.* * return CredentialsStep*/public CredentialsStep onRemotehost(String host);}public static interface CredentialsStep {/*** Username required to connect to remote machine Password required to connect to remote machine* * return BuildStep*/public BuildStep credentials(String user, String password);}public static interface BuildStep {/*** return an instance of a UserConfiguration based on the parameters passed during the creation.*/public UserConfiguration build();}private static class Steps implements NameStep, ServerStep, CredentialsStep, BuildStep {private String name;private String host;private String user;private String password;public BuildStep onLocalhost() {this.host localhost;return this;}public ServerStep name(String name) {this.name name;return null;}public CredentialsStep onRemotehost(String host) {this.host host;return this;}public BuildStep credentials(String user, String password) {this.user user;this.password password;return this;}public UserConfiguration build() {UserConfiguration userConfiguration new UserConfiguration(name);ServerDetails serverDetails new ServerDetails(host);serverDetails.setUser(user);serverDetails.setPassword(password);                    userConfiguration.setServerDetails(serverDetails);return userConfiguration;}} } 现在让我们看一下两个构建器的用户体验。 经典构建器将使用用户配置的名称进行构造然后它将公开其所有方法从而使用户过于自由无法选择下一步。 例如一个不小心的用户可能最终将UserConfiguration设置为localhost而无需身份验证仍然传递用户名和密码。 这令人困惑并且可能导致运行时异常。 这些是用户可能最终得到的UserConfigurations的一些可能组合其中一些是正确的很多是错误的 步骤构建器有一个完全不同的故事这里仅显示了当时的一个步骤 如果不需要凭据则不会公开它们只有在确定对象状态一致且完整时才提供build方法 使用此模式只能构建2个可能的UserConfigurations它们既有意义又对用户清晰。 结论 步骤构建器模式不是经典Bloch 模式的替代有时您想强迫用户在进行创建之前填充一些参数在这种情况下步骤构建器正在执行此工作否则当需要更开放的方法时比经典的建造者更适合您 参考从我们的JCG合作伙伴 Marco Castigliego 构建智能建筑商 位于“ 删除重复和修复不良名称”博客中。 翻译自: https://www.javacodegeeks.com/2013/05/building-smart-builders.html人工智能在建筑运营
http://www.zqtcl.cn/news/55753/

相关文章:

  • 水果网站建设方案书厦门外贸公司做网站
  • 南昌网站建设博客创意营销案例
  • 麦片网站建设禁用wordpress编辑器
  • 阿里巴巴国际站运营培训做海报素材的网站
  • 柳州做网站优化100个创意创业项目
  • 阿里网站多个域名wordpress文章语言切换
  • 网站访问量有什么用网站建设明细报价单
  • 织梦做的网站后台登录织梦系统做的网站打开慢
  • 长治一般建一个网站需要多少钱成都网站建设推广服务
  • 购物网站开发uml图网站开发商品管理表字段
  • 网站建设参考文献资料wordpress分类目录多级菜单
  • wordpress+三主题杭州百度整站优化服务
  • 淮北哪些企业做网站外贸soho建站多少钱
  • 做lt行业的人让我登网站湛江建设工程信息网
  • 汕头网站上排名网络软文范文
  • 成都 php 网站网站开发广告怎么写
  • 加强校园网站建设方案如何把wordpress转化为小程序
  • 网站动态图怎么做建站公司是什么
  • 能不能用自己的主机做网站html5网站正在建设中模板下载
  • 襄阳谷城网站开发长治在百度做个网站多少钱
  • 福建建设资格执业注册管理中心网站做问卷给钱的网站
  • 怎么做网站流量赚钱吗做网站的时候旋转图片
  • 南宁个人做网站的营销课程培训
  • wordpress 子网站重命名wordpress中视频播放
  • 做网站代码保密协议长春网站排名公司
  • 防止访问网站文件夹哈尔滨工程招标信息网
  • 简单的招聘网站怎么做杭州网站建设商业
  • 现在有什么网站可以做兼职的各行业的专业网址论坛资料
  • 网站建设软件有哪些免费网站建设的
  • 湖南网站seo公司一个服务器能放多少网站