SlideShare une entreprise Scribd logo
1  sur  11
Clean Code 5장
  형식 맞추기


                2012 02. 03
                    원종필
왜? 형식을 맞추나?


 코드 형식은 의사소통의 일환이다

        시간이 지나 코드의 흔적을
        더이상 찾아보기 어려울 정도로
        코드가 바뀌어도 개발자의 스타일과 규
        사라지지 않는다.
적절한 행 길이
 Vertical Formatting                                                                    77




                                         Figure 5-1
                 File length distributions LOG scale (box height = sigma)


                일반적으로 큰 파일보다는 작은 파일이 이해
      Junit, FitNesse, and Time and Money are composed of relatively small files. None
 are over 500 lines and most of those files are less than 200 lines. Tomcat and Ant, on the
 other hand, have some files that are several thousand lines long and close to half are over
 200 lines.
     What does that mean to us? It appears to be possible to build significant systems
Consider, for example, Listing 5-1. There are blank li
Vertical Formatting                                                                    79
                                                 declaration, the import(s), and each of the functions. This ex
                                                 found effect on the visual layout of the code. Each blank lin


      개념은 빈행으로 분리하라
                                                 a new and separate concept. As you scan down the listing,
                                                 line that follows a blank line.
    Listing 5-2
                                                     Listing 5-1
    BoldWidget.java                                  BoldWidget.java
    package fitnesse.wikitext.widgets;               package fitnesse.wikitext.widgets;
    import java.util.regex.*;                        import java.util.regex.*;
    public class BoldWidget extends ParentWidget {
      public static final String REGEXP = "'''.+?'''";
                                                     public class BoldWidget extends ParentWidget {
      private static final Pattern pattern = Pattern.compile("'''(.+?)'''",Pattern pattern"'''.+?'''";
                                                       public static final String REGEXP =
                                                       private static final                  = Pattern.com
        Pattern.MULTILINE + Pattern.DOTALL);              Pattern.MULTILINE + Pattern.DOTALL
      public BoldWidget(ParentWidget parent, String text) throws Exception {
                                                       );
        super(parent);                                 public BoldWidget(ParentWidget parent, String text
        Matcher match = pattern.matcher(text);            super(parent);
        match.find();                                     Matcher match = pattern.matcher(text);
                                                          match.find();
        addChildWidgets(match.group(1));}                 addChildWidgets(match.group(1));
      public String render() throws Exception {        }
        StringBuffer html = new StringBuffer("<b>");
                                                       public String render() throws Exception {
        html.append(childHtml()).append("</b>");          StringBuffer html = new StringBuffer("<b>");
        return html.toString();                           html.append(childHtml()).append("</b>");
      }                                                   return html.toString();
                                                       }
    }                                                }

This effect is even more pronounced when you unfocus your eyes. Inlines first example
                                                   Taking those blank the out, as in Listing 5-2, has a remar
the different groupings of 일련의 행 묶음은 완결된 생각하나를 표현한다readability of the code.
                           lines pop out at you, whereas the second example looks like a
muddle. The difference between these two listings빈 bit of v ertical openness. 분리해야 마땅하
                           생각 사이는 is a 행을 넣어서
종속함수
   public void Make() {
               String name = GetName();
               if(name != null)
                          SendName(name);
               else
                          PrintError();
   }

   public String GetName() {

   }
   public void SendName() {

   }
   public void PrintError() {


   프로그램이 자연스럽게 읽힐수 있게 함수를 배
   모듈 전체의 가독성도 높아진다.
가로 정렬
   private           Socket             socket;
   private           InputStream        input;
   private           OutputStream       output;
   protected         FitNesseContext    context;

   코드가 엉쭝한 부분을 강조해 진짜 의도가 가려
   변수유형을 무시하고 변수 이름부터 읽게 된다.

   private Socket socket;
   private InputStream input;
   private OutputStream output;
   protected FitNesseContext context;

   정렬이 필요할 정도로 목록이 길다면 문제는 목
형식...

 변수는 사용하는 위치에 최대한 가까이 선언한다.
 인스턴스 변수는 잘 알려진 위치에 모은다.
 비슷한 동작을 수행하는 함수들은 가까이 배치한다.
 함수 호출 종속성을 아래 방향으로 유지한다.
 들여쓰기를 사용하여 코드 구조가 한눈에 들어오게 한
가장 중요한것.

   팀에 속해서 프로그래밍을 한다면,
   팀이 정한 규칙을 따라야 한다.
   그래야 소프트웨어가 일관적인 스타일을 보인다
좋은 소프트웨어 시스템은 읽기 쉬운 문서로 이
Q/A
END

Contenu connexe

Tendances

Clean code(02)
Clean code(02)Clean code(02)
Clean code(02)규열 김
 
Pure Function and Honest Design
Pure Function and Honest DesignPure Function and Honest Design
Pure Function and Honest DesignHyungho Ko
 
Pure Function and Rx
Pure Function and RxPure Function and Rx
Pure Function and RxHyungho Ko
 
모두의 JIT 컴파일러
모두의 JIT 컴파일러모두의 JIT 컴파일러
모두의 JIT 컴파일러우경 성
 
Refactoring Tutorial 1주차[ Refactoring 개요]
Refactoring  Tutorial 1주차[ Refactoring 개요]Refactoring  Tutorial 1주차[ Refactoring 개요]
Refactoring Tutorial 1주차[ Refactoring 개요]Bingu Shim
 
[OKKYCON] 정진욱 - 테스트하기 쉬운 코드로 개발하기
[OKKYCON] 정진욱 - 테스트하기 쉬운 코드로 개발하기[OKKYCON] 정진욱 - 테스트하기 쉬운 코드로 개발하기
[OKKYCON] 정진욱 - 테스트하기 쉬운 코드로 개발하기OKKY
 
[ES6] 3. iteration
[ES6] 3. iteration[ES6] 3. iteration
[ES6] 3. iterationHan JaeYeab
 
Ai C#세미나
Ai C#세미나Ai C#세미나
Ai C#세미나Astin Choi
 
Api design for c++ 6장
Api design for c++ 6장Api design for c++ 6장
Api design for c++ 6장Ji Hun Kim
 
객체지향 단어가 의미하는 것
객체지향 단어가 의미하는 것객체지향 단어가 의미하는 것
객체지향 단어가 의미하는 것jaypi Ko
 
C언어 들어가기
C언어 들어가기C언어 들어가기
C언어 들어가기jaypi Ko
 
Java programming language test
Java programming language testJava programming language test
Java programming language testChiwon Song
 
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 1. primitive
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 1. primitive[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 1. primitive
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 1. primitiveNAVER D2
 
알고리즘 시각화 라이브러리 ipytracer 개발기
알고리즘 시각화 라이브러리 ipytracer 개발기알고리즘 시각화 라이브러리 ipytracer 개발기
알고리즘 시각화 라이브러리 ipytracer 개발기Han Lee
 

Tendances (16)

Clean code(02)
Clean code(02)Clean code(02)
Clean code(02)
 
Pure Function and Honest Design
Pure Function and Honest DesignPure Function and Honest Design
Pure Function and Honest Design
 
Pure Function and Rx
Pure Function and RxPure Function and Rx
Pure Function and Rx
 
모두의 JIT 컴파일러
모두의 JIT 컴파일러모두의 JIT 컴파일러
모두의 JIT 컴파일러
 
Refactoring Tutorial 1주차[ Refactoring 개요]
Refactoring  Tutorial 1주차[ Refactoring 개요]Refactoring  Tutorial 1주차[ Refactoring 개요]
Refactoring Tutorial 1주차[ Refactoring 개요]
 
[OKKYCON] 정진욱 - 테스트하기 쉬운 코드로 개발하기
[OKKYCON] 정진욱 - 테스트하기 쉬운 코드로 개발하기[OKKYCON] 정진욱 - 테스트하기 쉬운 코드로 개발하기
[OKKYCON] 정진욱 - 테스트하기 쉬운 코드로 개발하기
 
스도쿠
스도쿠스도쿠
스도쿠
 
[ES6] 3. iteration
[ES6] 3. iteration[ES6] 3. iteration
[ES6] 3. iteration
 
Ai C#세미나
Ai C#세미나Ai C#세미나
Ai C#세미나
 
Api design for c++ 6장
Api design for c++ 6장Api design for c++ 6장
Api design for c++ 6장
 
객체지향 단어가 의미하는 것
객체지향 단어가 의미하는 것객체지향 단어가 의미하는 것
객체지향 단어가 의미하는 것
 
C언어 들어가기
C언어 들어가기C언어 들어가기
C언어 들어가기
 
Java programming language test
Java programming language testJava programming language test
Java programming language test
 
C++ api design 품질
C++ api design 품질C++ api design 품질
C++ api design 품질
 
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 1. primitive
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 1. primitive[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 1. primitive
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 1. primitive
 
알고리즘 시각화 라이브러리 ipytracer 개발기
알고리즘 시각화 라이브러리 ipytracer 개발기알고리즘 시각화 라이브러리 ipytracer 개발기
알고리즘 시각화 라이브러리 ipytracer 개발기
 

En vedette

Browzring Dynamics
Browzring DynamicsBrowzring Dynamics
Browzring Dynamicsbrowzring
 
Fiona Marshall Modes conference September 2013
Fiona Marshall Modes conference September 2013Fiona Marshall Modes conference September 2013
Fiona Marshall Modes conference September 2013Fiona Marshall
 
School Improvement Plan
School Improvement PlanSchool Improvement Plan
School Improvement Planmhs2010
 
Real Propertyservices1
Real Propertyservices1Real Propertyservices1
Real Propertyservices1Vijay Gandhi
 
Konspekt
KonspektKonspekt
KonspektArtem
 
Thankful Journal- Miles
Thankful Journal- MilesThankful Journal- Miles
Thankful Journal- Milesmicklethwait
 
NPX Overview
NPX OverviewNPX Overview
NPX Overviewmurp5348
 
Twitter terms of service explained, by Brent Fleming
Twitter terms of service explained, by Brent FlemingTwitter terms of service explained, by Brent Fleming
Twitter terms of service explained, by Brent Flemingbrentf99
 
Creating a Business Plan for a fake blog
Creating a Business Plan for a fake blogCreating a Business Plan for a fake blog
Creating a Business Plan for a fake blogrfair404
 
兒童前期親職教育
兒童前期親職教育兒童前期親職教育
兒童前期親職教育Kuo-Yi Chen
 
Thankful Journals 2014 Emma
Thankful Journals 2014 EmmaThankful Journals 2014 Emma
Thankful Journals 2014 Emmamicklethwait
 
Programa video tutorial
Programa video tutorialPrograma video tutorial
Programa video tutorialUPBC
 
3 the numbers 101 3,000,000
3 the numbers 101 3,000,0003 the numbers 101 3,000,000
3 the numbers 101 3,000,000Laura Riddle
 
Networking 101
Networking 101Networking 101
Networking 101AuntMyra
 

En vedette (20)

Browzring Dynamics
Browzring DynamicsBrowzring Dynamics
Browzring Dynamics
 
Fiona Marshall Modes conference September 2013
Fiona Marshall Modes conference September 2013Fiona Marshall Modes conference September 2013
Fiona Marshall Modes conference September 2013
 
School Improvement Plan
School Improvement PlanSchool Improvement Plan
School Improvement Plan
 
The ExhibEAT
The ExhibEATThe ExhibEAT
The ExhibEAT
 
Real Propertyservices1
Real Propertyservices1Real Propertyservices1
Real Propertyservices1
 
Konspekt
KonspektKonspekt
Konspekt
 
Thankful Journal- Miles
Thankful Journal- MilesThankful Journal- Miles
Thankful Journal- Miles
 
NPX Overview
NPX OverviewNPX Overview
NPX Overview
 
Twitter terms of service explained, by Brent Fleming
Twitter terms of service explained, by Brent FlemingTwitter terms of service explained, by Brent Fleming
Twitter terms of service explained, by Brent Fleming
 
Tdd 마무리
Tdd 마무리Tdd 마무리
Tdd 마무리
 
Kurikulum program-doktor
Kurikulum program-doktorKurikulum program-doktor
Kurikulum program-doktor
 
Chicken breast sous vide
Chicken breast sous videChicken breast sous vide
Chicken breast sous vide
 
Creating a Business Plan for a fake blog
Creating a Business Plan for a fake blogCreating a Business Plan for a fake blog
Creating a Business Plan for a fake blog
 
Slamon sous vide rare and medium rare
Slamon sous vide rare and medium rareSlamon sous vide rare and medium rare
Slamon sous vide rare and medium rare
 
兒童前期親職教育
兒童前期親職教育兒童前期親職教育
兒童前期親職教育
 
Thankful Journals 2014 Emma
Thankful Journals 2014 EmmaThankful Journals 2014 Emma
Thankful Journals 2014 Emma
 
Programa video tutorial
Programa video tutorialPrograma video tutorial
Programa video tutorial
 
3 the numbers 101 3,000,000
3 the numbers 101 3,000,0003 the numbers 101 3,000,000
3 the numbers 101 3,000,000
 
Networking 101
Networking 101Networking 101
Networking 101
 
Manual Esencial Biología II
Manual Esencial Biología IIManual Esencial Biología II
Manual Esencial Biología II
 

Similaire à [2012 02 03]clean_code 5장

Domain Specific Languages With Groovy
Domain Specific Languages With GroovyDomain Specific Languages With Groovy
Domain Specific Languages With GroovyTommy C. Kang
 
Clean code(05)
Clean code(05)Clean code(05)
Clean code(05)규열 김
 
Scala, Scalability
Scala, ScalabilityScala, Scalability
Scala, ScalabilityDongwook Lee
 
카사 공개세미나1회 W.E.L.C.
카사 공개세미나1회  W.E.L.C.카사 공개세미나1회  W.E.L.C.
카사 공개세미나1회 W.E.L.C.Ryan Park
 
읽기 좋은 코드가 좋은 코드다 Part one
읽기 좋은 코드가 좋은 코드다   Part one읽기 좋은 코드가 좋은 코드다   Part one
읽기 좋은 코드가 좋은 코드다 Part oneJi Hun Kim
 
About Visual C++ 10
About  Visual C++ 10About  Visual C++ 10
About Visual C++ 10흥배 최
 
SpringCamp 2013 : About Jdk8
SpringCamp 2013 : About Jdk8SpringCamp 2013 : About Jdk8
SpringCamp 2013 : About Jdk8Sangmin Lee
 
NDC11_김성익_슈퍼클래스
NDC11_김성익_슈퍼클래스NDC11_김성익_슈퍼클래스
NDC11_김성익_슈퍼클래스Sungik Kim
 
Angular2 가기전 Type script소개
 Angular2 가기전 Type script소개 Angular2 가기전 Type script소개
Angular2 가기전 Type script소개Dong Jun Kwon
 
I phone 2 release
I phone 2 releaseI phone 2 release
I phone 2 releaseJaehyeuk Oh
 
Net debugging 3_전한별
Net debugging 3_전한별Net debugging 3_전한별
Net debugging 3_전한별Han-Byul Jeon
 
2015 나는 프로그래머다 컨퍼런스 (11) 염산악 - 가독성에 대하여
2015 나는 프로그래머다 컨퍼런스 (11) 염산악 - 가독성에 대하여2015 나는 프로그래머다 컨퍼런스 (11) 염산악 - 가독성에 대하여
2015 나는 프로그래머다 컨퍼런스 (11) 염산악 - 가독성에 대하여iamprogrammerofficial
 
Refactoring Tutorial 1주차[ Refactoring 개요]
Refactoring  Tutorial 1주차[ Refactoring 개요]Refactoring  Tutorial 1주차[ Refactoring 개요]
Refactoring Tutorial 1주차[ Refactoring 개요]Bingu Shim
 
MongoDB 하루만에 끝내기
MongoDB 하루만에 끝내기MongoDB 하루만에 끝내기
MongoDB 하루만에 끝내기Seongkuk Park
 
파이썬 함수 이해하기
파이썬 함수 이해하기 파이썬 함수 이해하기
파이썬 함수 이해하기 Yong Joon Moon
 

Similaire à [2012 02 03]clean_code 5장 (20)

Domain Specific Languages With Groovy
Domain Specific Languages With GroovyDomain Specific Languages With Groovy
Domain Specific Languages With Groovy
 
Clean code(05)
Clean code(05)Clean code(05)
Clean code(05)
 
Scala, Scalability
Scala, ScalabilityScala, Scalability
Scala, Scalability
 
Scalability
ScalabilityScalability
Scalability
 
함수적 사고 2장
함수적 사고 2장함수적 사고 2장
함수적 사고 2장
 
카사 공개세미나1회 W.E.L.C.
카사 공개세미나1회  W.E.L.C.카사 공개세미나1회  W.E.L.C.
카사 공개세미나1회 W.E.L.C.
 
읽기 좋은 코드가 좋은 코드다 Part one
읽기 좋은 코드가 좋은 코드다   Part one읽기 좋은 코드가 좋은 코드다   Part one
읽기 좋은 코드가 좋은 코드다 Part one
 
About Visual C++ 10
About  Visual C++ 10About  Visual C++ 10
About Visual C++ 10
 
Working with code
Working with codeWorking with code
Working with code
 
SpringCamp 2013 : About Jdk8
SpringCamp 2013 : About Jdk8SpringCamp 2013 : About Jdk8
SpringCamp 2013 : About Jdk8
 
NDC11_김성익_슈퍼클래스
NDC11_김성익_슈퍼클래스NDC11_김성익_슈퍼클래스
NDC11_김성익_슈퍼클래스
 
JDK 변천사
JDK 변천사JDK 변천사
JDK 변천사
 
Angular2 가기전 Type script소개
 Angular2 가기전 Type script소개 Angular2 가기전 Type script소개
Angular2 가기전 Type script소개
 
I phone 2 release
I phone 2 releaseI phone 2 release
I phone 2 release
 
Net debugging 3_전한별
Net debugging 3_전한별Net debugging 3_전한별
Net debugging 3_전한별
 
Java script
Java scriptJava script
Java script
 
2015 나는 프로그래머다 컨퍼런스 (11) 염산악 - 가독성에 대하여
2015 나는 프로그래머다 컨퍼런스 (11) 염산악 - 가독성에 대하여2015 나는 프로그래머다 컨퍼런스 (11) 염산악 - 가독성에 대하여
2015 나는 프로그래머다 컨퍼런스 (11) 염산악 - 가독성에 대하여
 
Refactoring Tutorial 1주차[ Refactoring 개요]
Refactoring  Tutorial 1주차[ Refactoring 개요]Refactoring  Tutorial 1주차[ Refactoring 개요]
Refactoring Tutorial 1주차[ Refactoring 개요]
 
MongoDB 하루만에 끝내기
MongoDB 하루만에 끝내기MongoDB 하루만에 끝내기
MongoDB 하루만에 끝내기
 
파이썬 함수 이해하기
파이썬 함수 이해하기 파이썬 함수 이해하기
파이썬 함수 이해하기
 

Plus de Jong Pil Won

[2012 11 12]애자일 회고
[2012 11 12]애자일 회고[2012 11 12]애자일 회고
[2012 11 12]애자일 회고Jong Pil Won
 
[2012 03 17]clean_code 14장 점진적개선
[2012 03 17]clean_code 14장 점진적개선[2012 03 17]clean_code 14장 점진적개선
[2012 03 17]clean_code 14장 점진적개선Jong Pil Won
 
파이썬3프로그래밍 2장 2003
파이썬3프로그래밍 2장 2003파이썬3프로그래밍 2장 2003
파이썬3프로그래밍 2장 2003Jong Pil Won
 
[2012 02 03]clean_code 4장
[2012 02 03]clean_code 4장[2012 02 03]clean_code 4장
[2012 02 03]clean_code 4장Jong Pil Won
 
[2012 01 28]cleancode 3장
[2012 01 28]cleancode 3장[2012 01 28]cleancode 3장
[2012 01 28]cleancode 3장Jong Pil Won
 
[2012 01 28]cleancode 1장
[2012 01 28]cleancode 1장[2012 01 28]cleancode 1장
[2012 01 28]cleancode 1장Jong Pil Won
 
[2011 05 21] 4장 제어
[2011 05 21] 4장 제어[2011 05 21] 4장 제어
[2011 05 21] 4장 제어Jong Pil Won
 
[2011 05 21] 4장 제어
[2011 05 21] 4장 제어[2011 05 21] 4장 제어
[2011 05 21] 4장 제어Jong Pil Won
 
[2011 05 21] 4장 제어
[2011 05 21] 4장 제어[2011 05 21] 4장 제어
[2011 05 21] 4장 제어Jong Pil Won
 
[2011 04 30]python-3장
[2011 04 30]python-3장[2011 04 30]python-3장
[2011 04 30]python-3장Jong Pil Won
 
Tdd 실습&나머지
Tdd 실습&나머지Tdd 실습&나머지
Tdd 실습&나머지Jong Pil Won
 
[2011 04 11]mock_object 소개
[2011 04 11]mock_object 소개[2011 04 11]mock_object 소개
[2011 04 11]mock_object 소개Jong Pil Won
 
10장 동기부여와훈련 경험
10장 동기부여와훈련 경험10장 동기부여와훈련 경험
10장 동기부여와훈련 경험Jong Pil Won
 

Plus de Jong Pil Won (14)

[2012 11 12]애자일 회고
[2012 11 12]애자일 회고[2012 11 12]애자일 회고
[2012 11 12]애자일 회고
 
[2012 03 17]clean_code 14장 점진적개선
[2012 03 17]clean_code 14장 점진적개선[2012 03 17]clean_code 14장 점진적개선
[2012 03 17]clean_code 14장 점진적개선
 
파이썬3프로그래밍 2장 2003
파이썬3프로그래밍 2장 2003파이썬3프로그래밍 2장 2003
파이썬3프로그래밍 2장 2003
 
[2012 02 03]clean_code 4장
[2012 02 03]clean_code 4장[2012 02 03]clean_code 4장
[2012 02 03]clean_code 4장
 
[2012 01 28]cleancode 3장
[2012 01 28]cleancode 3장[2012 01 28]cleancode 3장
[2012 01 28]cleancode 3장
 
[2012 01 28]cleancode 1장
[2012 01 28]cleancode 1장[2012 01 28]cleancode 1장
[2012 01 28]cleancode 1장
 
[2011 05 21] 4장 제어
[2011 05 21] 4장 제어[2011 05 21] 4장 제어
[2011 05 21] 4장 제어
 
[2011 05 21] 4장 제어
[2011 05 21] 4장 제어[2011 05 21] 4장 제어
[2011 05 21] 4장 제어
 
[2011 05 21] 4장 제어
[2011 05 21] 4장 제어[2011 05 21] 4장 제어
[2011 05 21] 4장 제어
 
[2011 04 30]python-3장
[2011 04 30]python-3장[2011 04 30]python-3장
[2011 04 30]python-3장
 
Tdd 실습&나머지
Tdd 실습&나머지Tdd 실습&나머지
Tdd 실습&나머지
 
[2011 04 11]mock_object 소개
[2011 04 11]mock_object 소개[2011 04 11]mock_object 소개
[2011 04 11]mock_object 소개
 
Tdd 4장
Tdd 4장Tdd 4장
Tdd 4장
 
10장 동기부여와훈련 경험
10장 동기부여와훈련 경험10장 동기부여와훈련 경험
10장 동기부여와훈련 경험
 

[2012 02 03]clean_code 5장

  • 1. Clean Code 5장 형식 맞추기 2012 02. 03 원종필
  • 2. 왜? 형식을 맞추나? 코드 형식은 의사소통의 일환이다 시간이 지나 코드의 흔적을 더이상 찾아보기 어려울 정도로 코드가 바뀌어도 개발자의 스타일과 규 사라지지 않는다.
  • 3. 적절한 행 길이 Vertical Formatting 77 Figure 5-1 File length distributions LOG scale (box height = sigma) 일반적으로 큰 파일보다는 작은 파일이 이해 Junit, FitNesse, and Time and Money are composed of relatively small files. None are over 500 lines and most of those files are less than 200 lines. Tomcat and Ant, on the other hand, have some files that are several thousand lines long and close to half are over 200 lines. What does that mean to us? It appears to be possible to build significant systems
  • 4. Consider, for example, Listing 5-1. There are blank li Vertical Formatting 79 declaration, the import(s), and each of the functions. This ex found effect on the visual layout of the code. Each blank lin 개념은 빈행으로 분리하라 a new and separate concept. As you scan down the listing, line that follows a blank line. Listing 5-2 Listing 5-1 BoldWidget.java BoldWidget.java package fitnesse.wikitext.widgets; package fitnesse.wikitext.widgets; import java.util.regex.*; import java.util.regex.*; public class BoldWidget extends ParentWidget { public static final String REGEXP = "'''.+?'''"; public class BoldWidget extends ParentWidget { private static final Pattern pattern = Pattern.compile("'''(.+?)'''",Pattern pattern"'''.+?'''"; public static final String REGEXP = private static final = Pattern.com Pattern.MULTILINE + Pattern.DOTALL); Pattern.MULTILINE + Pattern.DOTALL public BoldWidget(ParentWidget parent, String text) throws Exception { ); super(parent); public BoldWidget(ParentWidget parent, String text Matcher match = pattern.matcher(text); super(parent); match.find(); Matcher match = pattern.matcher(text); match.find(); addChildWidgets(match.group(1));} addChildWidgets(match.group(1)); public String render() throws Exception { } StringBuffer html = new StringBuffer("<b>"); public String render() throws Exception { html.append(childHtml()).append("</b>"); StringBuffer html = new StringBuffer("<b>"); return html.toString(); html.append(childHtml()).append("</b>"); } return html.toString(); } } } This effect is even more pronounced when you unfocus your eyes. Inlines first example Taking those blank the out, as in Listing 5-2, has a remar the different groupings of 일련의 행 묶음은 완결된 생각하나를 표현한다readability of the code. lines pop out at you, whereas the second example looks like a muddle. The difference between these two listings빈 bit of v ertical openness. 분리해야 마땅하 생각 사이는 is a 행을 넣어서
  • 5. 종속함수 public void Make() { String name = GetName(); if(name != null) SendName(name); else PrintError(); } public String GetName() { } public void SendName() { } public void PrintError() { 프로그램이 자연스럽게 읽힐수 있게 함수를 배 모듈 전체의 가독성도 높아진다.
  • 6. 가로 정렬 private Socket socket; private InputStream input; private OutputStream output; protected FitNesseContext context; 코드가 엉쭝한 부분을 강조해 진짜 의도가 가려 변수유형을 무시하고 변수 이름부터 읽게 된다. private Socket socket; private InputStream input; private OutputStream output; protected FitNesseContext context; 정렬이 필요할 정도로 목록이 길다면 문제는 목
  • 7. 형식... 변수는 사용하는 위치에 최대한 가까이 선언한다. 인스턴스 변수는 잘 알려진 위치에 모은다. 비슷한 동작을 수행하는 함수들은 가까이 배치한다. 함수 호출 종속성을 아래 방향으로 유지한다. 들여쓰기를 사용하여 코드 구조가 한눈에 들어오게 한
  • 8. 가장 중요한것. 팀에 속해서 프로그래밍을 한다면, 팀이 정한 규칙을 따라야 한다. 그래야 소프트웨어가 일관적인 스타일을 보인다
  • 9. 좋은 소프트웨어 시스템은 읽기 쉬운 문서로 이
  • 10. Q/A
  • 11. END