自我感觉良好的代码书写格式(献丑了)

一直用传统的代码书写格式,感觉有的代码很乱,突发奇想,可不可以即追求技术,又追求艺术了,所以就自己在那瞎排了一个代码的书写格式,目前只是初步的想法而已,,还需要很多改进;

小二,上代码(这段代码的内容是有关Java网络编程的,内容无所谓,咱们主要看书写的格式)

package com.dong.Address;

import java.net.InetAddress;
import java.net.UnknownHostException;


public class TestAddress {
	public void TInetAddress() 
												throws UnknownHostException
												{InetAddress address = InetAddress.getByName("www.baidu.com");
												SecurityManager sm = new SecurityManager();
												sm.checkConnect("www.baidu.com", -1);
												sm.checkConnect("www.baidu.com",3);
												System.out.println(address);
												}
	public void TInetAddress2()
												{InetAddress address;
												try {address = InetAddress.getByName("61.135.169.125");
												System.out.println(address.getHostName());
															
												} catch (UnknownHostException e) {
												e.printStackTrace();
												}
												}
	public void TInetAddress3()
												throws UnknownHostException						
												{InetAddress[] addresses = InetAddress.getAllByName("www.baidu.com");
												for(InetAddress address : addresses) 
												{System.out.println(address);}
															
												}
	public static void main(String args[])
												{TestAddress ta = new TestAddress();
												try {
												ta.TInetAddress();
												ta.TInetAddress2();
												ta.TInetAddress3();
															
												} catch (UnknownHostException e)
												{e.printStackTrace();
												}
												}
}
package com.dong.Address;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class TestURL {
public  static  void main(String args[]) 
											throws IOException
											{URL url = new URL("https://www.baidu.com");
											CookieManager manager = new CookieManager();
											manager.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
											CookieHandler.setDefault(manager);
											InputStream input = url.openStream();
											OutputStream out = new FileOutputStream(new File("C:\\Users\\liumin\\Desktop\\baidu.txt"));
											byte [] b = new byte[1024];
											while((input.read() != -1)) {
											input.read(b, 0, 1024);
											out.write(b);
											URLConnection uc= url.openConnection();
											InputStream in = uc.getInputStream();
											Object  o = url.getContent();
											String str = URLEncoder.encode("this String has spaces", "UTF-8");
											System.out.println(str);
											System.out.println(URLDecoder.decode(str, "UTF-8"));
											}
											}

}

感觉这样书写的方便之处在于:

函数首部和函数体错开,可以清楚的知道此类有什么方法,如果想注释,可在左边空白处注释功能;

整个代码看起来很整洁

不足:需要在函数体中,必须有明确的代码块区分,方便更迅速的知道各个{}的范围;

 

 

全部评论

相关推荐

hanliu:1. 排版与格式问题字体与对齐问题:标题和内容的字体大小差异不够明显,无法迅速吸引目光。某些文字看起来有些拥挤(比如校园经历中的“班委成员”部分)。2. 内容逻辑性模块顺序问题:实习经历放在较靠后的位置,实际上这部分内容对应聘来说更重要,建议提前突出。细节表述不够突出:比如教育背景部分的专业课程仅仅列出名字,没有说明自己在这些课程中表现如何或者掌握了什么技能,缺乏量化描述。多余内容:例如“班委成员”和“宣传委员”这类校园经历,叙述过于普通,缺乏和岗位相关的实质性贡献。,建议简写。3. 措辞专业性表达不够精准:例如“协助班长与团支书更好地为同学服务”显得较为笼统,没有实际成果的体现。用词重复:如“学习了焊接”“学习了光检”等重复词语较多,缺乏丰富的动词来展示个人能力(如“负责”“优化”“改进”等)。技能展示不足:虽然列出了UG和CAD证书,但没有明确提到这些技能如何在实际工作中发挥作用。4. 技能匹配度技能深度不足:虽然列出了掌握的软件和技术,但没有描述技能水平(如“熟练掌握”“精通”),也没有具体案例支持这些技能。缺乏岗位导向性:比如针对机械设计与制造方向,实习经历提到了“E6尾灯项目”,但没有详细说明自己在其中的技术贡献,可能会显得经验描述泛泛而谈。5. 自我评价问题表达空泛:如“具有良好的沟通协调能力”“责任心强”之类的描述太常见,没有让人眼前一亮的特点。缺乏成果支持:自我评价中的能力没有用具体项目、经历或成就来验证,可信度较弱。 兄弟加油
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务