tailieunhanh - Chapter12: Coding Standards

The Developer exam is challenging. There are a lot of complex design issues to consider, and a host of advanced Java technologies to understand and implement correctly. The exam assessors work under very strict guidelines. You can create the most brilliant application ever to grace a JVM, but if you don’t cross your t’s and dot your i’s the assessors have no choice but to deduct crucial (and sometimes substantial) points from your project. | JAVA 2 SUN CERTIFIED PROGRAMMER DEVELOPER 12 Coding Standards CERTIFICATION OBJECTIVES Use Sun Java Coding Standards 2 Chapter 12 Coding Standards CERTIFICATION OBJECTIVE Use Sun Java Coding Standards The Developer exam is challenging. There are a lot of complex design issues to consider and a host of advanced Java technologies to understand and implement correctly. The exam assessors work under very strict guidelines. You can create the most brilliant application ever to grace a JVM but if you don t cross your t s and dot your i s the assessors have no choice but to deduct crucial and sometimes substantial points from your project. This chapter will help you cross your t s and dot your i s. Following coding standards is not hard it just requires diligence. If you are careful it s no-brainer stuff and it would be a shame to lose points because of a curly brace in the wrong place. The Developer exam stresses things that must be done to avoid automatic failure. The exam uses the word must frequently. When we use the word must we use it in the spirit of the exam if you must you must so just get on with it. Let s dive into the fascinating world ofJava Coding Standards. Spacing Standards This section covers the standards for indenting line-length limits line breaking and white space. Indenting We said this was going to be fascinating didn t we Each level of indentation must be four spaces exactly four spaces always four spaces. Tabs must be set to eight spaces. If you are in several levels of indentation you can use a combination of tabs and sets of four spaces to accomplish the correct indentation. So if you are in a method and you need to indent 12 spaces you can either press SPACEBAR 12 times or press TAB once and then press SPACEBAR four times. Slow down coach. We recommend not using the TAB key and sticking to the SPACEBAR it s just a bit safer. When to Indent If you indent like this you ll make your assessor proud Beginning comments package declarations import .

TỪ KHÓA LIÊN QUAN