20155215宣言 实验三 敏捷开发与XP实践 实验报告
实验内容
XP基础
XP核心实践
相关工具
实验要求
1.没有Linux基础的同学建议先学习《Linux基础入门(新版)》《Vim编辑器》 课程
2.完成实验、撰写实验报告,实验报告以博客方式发表在博客园,注意实验报告重点是运行结果,遇到的问题(工具查找,安装,使用,程序的编辑,调试,运行等)、解决办法(空洞的方法如“查网络”、“问同学”、“看书”等一律得0分)以及分析(从中可以得到什么启示,有什么收获,教训等)。报告可以参考范飞龙老师的指导
- 严禁抄袭,有该行为者实验成绩归零,并附加其他惩罚措施。
实验步骤
(一)敏捷开发与XP
1.Eclipse的内容替换成IDEA
在IDEA中使用工具(Code->Reformate Code)把下面代码重新格式化,再研究一下Code菜单,找出一项让自己感觉最好用的功能。提交截图,加上自己学号水印。
public class CodeStandard {
public static void main(String [] args){
StringBuffer buffer = new StringBuffer();
buffer.append('S');
buffer.append("tringBuffer");
System.out.println(buffer.charAt(1));
System.out.println(buffer.capacity());
System.out.println(buffer.indexOf("tring"));
System.out.println("buffer = " + buffer.toString());
if(buffer.capacity()<20)
buffer.append("1234567");
for(int i=0; i<buffer.length();i++)
System.out.println(buffer.charAt(i));
}
}
重新格式化后如下:
/**
* Created by XY on 2017/5/3.
*/
public class CodeStandard {
public static void main(String [] args){
StringBuffer buffer = new StringBuffer();
buffer.append('S');
buffer.append("tringBuffer");
System.out.println(buffer.charAt(1));
System.out.println(buffer.capacity());
System.out.println(buffer.indexOf("tring"));
System.out.println("buffer = " + buffer.toString());
if(buffer.capacity()<20)
buffer.append("1234567");
for(int i=0; i<buffer.length();i++)
System.out.println(buffer.charAt(i));
}
}

在IDEA中的code菜单中的功能基本上都是关于代码本身的,格式化,代码上下换行等等,其中有optimize imports这一个选项,它的主要功能是删除无用和错误的import,我觉得挺好的。
2.测试搭档的复数类代码
在码云上把自己的学习搭档加入自己的项目中,确认搭档的项目加入自己后,下载搭档实验二的Complex代码,加入不少于三个JUnit单元测试用例,测试成功后git add .; git commit -m "自己学号 添加内容";git push;提交搭档项目git log的截图,包含上面git commit的信息,并加上自己的学号水印信息。
我是和20155232李书琪结对学习的,她的复数类代码如下:
public class MyComplex {
//定义属性并生成getter,setter
double RealPart;
double ImagePart;
public double getRealPart() {
return RealPart;
}
public void setRealPart(double realPart) {
RealPart = realPart;
}
public double getImagePart() {
return ImagePart;
}
public void setImagePart(double imagePart) {
ImagePart = imagePart;
}
//定义构造函数
public MyComplex(double R, double I) {
RealPart = R;
ImagePart = I;
}
//Override Object
public boolean equals(MyComplex obj1) {
if (this.getRealPart () == obj1.getRealPart () && this.getImagePart () == obj1.getImagePart ())
return true;
else return false;
}
//定义公有方法:加减乘除
public String toString() {
return RealPart + " + " + ImagePart + "i";
}
public MyComplex ComplexAdd(MyComplex obj) {
return new MyComplex ( RealPart + obj.getRealPart (), ImagePart + obj.getImagePart () );
}
public MyComplex ComplexSub(MyComplex obj) {
return new MyComplex ( RealPart - obj.getRealPart (), ImagePart - obj.getImagePart () );
}
public MyComplex ComplexMulti(MyComplex obj) {
return new MyComplex ( RealPart * obj.getRealPart () - ImagePart * obj.getImagePart (), RealPart * obj.getImagePart () + ImagePart * obj.getRealPart () );
}
}
我写的测试用例如下:
import junit.framework.TestCase;
import org.junit.Test;
/**
* Created by XY on 2017/5/3.
*/
public class MyComplexTest extends TestCase {
MyComplex c1 = new MyComplex(2, 3);
MyComplex c2 = new MyComplex(2, 3);
@Test
public void testgetRealPart() {
assertEquals(2.0, c1.getRealPart());
}
@Test
public void testNormal() {
MyComplex a = new MyComplex(1,1);
assertEquals("1.0 + 1.0i", a.toString());
}
@Test
public void testComplexAdd() throws Exception {
assertEquals("2.0 + 3.0i", c1.toString());
assertEquals("4.0 + 6.0i", c1.ComplexAdd(c2).toString());
}
@Test
public void testComplexSub() throws Exception {
assertEquals("0.0 + 0.0i", c1.ComplexSub(c2).toString());
}
@Test
public void testComplexMulti() throws Exception {
assertEquals("-5.0 + 12.0i", c1.ComplexMulti(c2).toString());
}
}
运行截图如下:

3.完成重构内容的练习
下载搭档的代码,至少进行三项重构,提交重构后代码的截图,加上自己的学号水印。提交搭档的码云项目链接。
重构之后如下所示:
public class RPG1 {
public static void main(String[] args) {
SwordsMan swordsMan = new SwordsMan();
swordsMan.setName("Justin");
swordsMan.setLevel(1);
swordsMan.setBlood(200);
Magician magician = new Magician();
magician.setName("Monica");
magician.setLevel(1);
magician.setBlood(100);
showBlood(swordsMan);
showBlood(magician);
}
static void showBlood(Role role) {
System.out.printf("%s 血量 %d%n", role.getName(), role.getBlood());
}
}

4.以结对的方式完成Java密码学相关内容的学习,结合重构,git,代码标准。
提交学习成果码云链接和代表性成果截图,要有学号水印。
代表性成果是我们运行出的密码学代码截图,我们运行的是下面这个代码:
import java.io.*;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
public class SDec{
public static void main(String args[]) throws Exception{
// 获取密文
FileInputStream f=new FileInputStream("SEnc.dat");
int num=f.available();
byte[ ] ctext=new byte[num];
f.read(ctext);
// 获取密钥
FileInputStream f2=new FileInputStream("keykb1.dat");
int num2=f2.available();
byte[ ] keykb=new byte[num2];
f2.read(keykb);
SecretKeySpec k=new SecretKeySpec(keykb,"DESede");
// 解密
Cipher cp=Cipher.getInstance("DESede");
cp.init(Cipher.DECRYPT_MODE, k);
byte []ptext=cp.doFinal(ctext);
// 显示明文
String p=new String(ptext,"UTF8");
System.out.println(p);
}
}
运行截图如下:

自己的PSP(Personal Software Process)时间
| 步骤 | 耗时 | 百分比 |
|---|---|---|
| 需求分析 | 20min | 17% |
| 设计 | 30min | 25% |
| 代码实现 | 40min | 33% |
| 测试 | 15min | 12.5% |
| 分析总结 | 15min | 12.5% |
20155215宣言 实验三 敏捷开发与XP实践 实验报告的更多相关文章
- 20145308刘昊阳 《Java程序设计》实验三 敏捷开发与XP实践 实验报告
20145308刘昊阳 <Java程序设计>实验三 敏捷开发与XP实践 实验报告 实验名称 敏捷开发与XP实践 实验内容 XP基础 XP核心实践 相关工具 统计的PSP(Personal ...
- 20162311 实验三 敏捷开发与XP实践 实验报告
20162311 实验三 敏捷开发与XP实践 实验报告 实验内容 一.研究学习IDEA中的Code菜单 使用Code ->Reformate Code功能将以下代码格式化 public clas ...
- 20165308实验三 敏捷开发与XP实践实验报告
实验三 敏捷开发与XP实践实验报告 实验目的 安装 alibaba 插件,解决代码中的规范问题.再研究一下Code菜单,找出一项让自己感觉最好用的功能. 在码云上把自己的学习搭档加入自己的项目中,确认 ...
- 20165230 《Java程序设计》实验三 敏捷开发与XP实践 实验报告
20165230 <Java程序设计>实验三 敏捷开发与XP实践 实验报告 一.实验报告封面 课程:Java程序设计 班级:1652班 姓名:田坤烨 学号:20165230 成绩: 指导教 ...
- 20155207王雪纯 《Java程序设计》实验三 敏捷开发与XP实践 实验报告
20155207王雪纯 <Java程序设计>实验三 敏捷开发与XP实践 实验报告 实验名称 敏捷开发与XP实践 实验内容 XP基础 XP核心实践 相关工具 统计的PSP(Personal ...
- 20155220 实验三 敏捷开发与XP实践 实验报告
20155220 实验三 敏捷开发与XP实践 实验报告 实验内容 XP基础 XP核心实践 相关工具 实验要求 没有Linux基础的同学建议先学习<Linux基础入门(新版)><Vim ...
- # 20155224 实验三 敏捷开发与XP实践 实验报告
20155224 实验三 敏捷开发与XP实践 实验报告 实验内容 XP基础 XP核心实践 相关工具 实验要求 没有Linux基础的同学建议先学习<Linux基础入门(新版)><Vim ...
- 20155226 实验三 敏捷开发与XP实践 实验报告
20155226 实验三 敏捷开发与XP实践 实验报告 实验内容 XP基础 XP核心实践 相关工具 实验要求 没有Linux基础的同学建议先学习<Linux基础入门(新版)><Vim ...
- 20155311 实验三 敏捷开发与XP实践 实验报告
20155311 实验三 敏捷开发与XP实践 实验报告 实验内容 XP基础 xp核心工具 相关工具 实验要求 没有Linux基础的同学建议先学习<Linux基础入门(新版)><Vim ...
- 2016-2017-2 20155339 《Java面向对象程序设计》实验三敏捷开发与XP实践实验报告
2016-2017-2 20155339 <Java面向对象程序设计>实验三敏捷开发与XP实践实验报告 实验内容 XP基础 XP核心实践 相关工具 实验内容 一.在IDEA中使用工具(Co ...
随机推荐
- Azure 登录设置
转自 http://blog.csdn.net/azure_nonofficial/article/details/38095459 这是我们Azure非官方的第一篇博文,欢迎大家各种拍砖. 微软云计 ...
- c++抽象类,纯虚函数
- Hadoop学习之路(二十六)MapReduce的API使用(三)
影评案例 数据及需求 数据格式 movies.dat 3884条数据 1::Toy Story (1995)::Animation|Children's|Comedy 2::Jumanji (1995 ...
- 一步步入门编写PHP扩展
1.写在最前 随着互联网飞速发展,lamp架构的流行,php支持的扩展也越来越多,这样直接促进了php的发展. 但是php也有脚本语言不可避免的问题,性能比例如C等编译型语言相差甚多,所以在考虑性能问 ...
- 如何将pip更新到最新版
通过该命令即可达到目的:python -m pip install --upgrade pip pip在Python中是非常常用的,就像node.js里面的npm一样.两者共同的作用是包的管理工具.
- php编译安装报错
Cannot find OpenSSL's <evp.h> 解决方法: 下载openssl-1.1.0h.tar 包 [root@localhost ~]# cd openssl-1.1 ...
- Dubbo实践(一)入门示例
dubbo是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案.简单的说,dubbo就是个服务框架,如果没有分布式的需求,其实是不需要用的,只有在分布式的时候 ...
- 用 S5PV210 学习 Linux (二) 刷机(二)
1.在 Ubuntu 下 ,进入 dnw-linux-master\src\driver 文件下,make 截图 如下: 2.紧接着 加载该模块到内核(注意:需要root权限),sudo insmo ...
- C#中枚举
1.枚举是一组命名整形常量,枚举类型使用Enum关键字进行声明的.在C#中枚举是值数据类型,枚举包含自己的值,且不能继承或传递继承.
- Project Euler:Problem 86 Cuboid route
A spider, S, sits in one corner of a cuboid room, measuring 6 by 5 by 3, and a fly, F, sits in the o ...