c# ean 13 check digit Visual Basic example of endline layout of a while block. in C#

Making EAN 13 in C# Visual Basic example of endline layout of a while block.

Listing 31-21. Visual Basic example of endline layout of a while block.
EAN-13 Supplement 5 Creator In Visual C#
Using Barcode drawer for Visual Studio .NET Control to generate, create GTIN - 13 image in .NET framework applications.
www.OnBarcode.com
EAN13 Scanner In Visual C#.NET
Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
While ( pixelColor = Color_Red ) statement1; statement2; ... Wend
Encode Barcode In C#.NET
Using Barcode generation for .NET framework Control to generate, create bar code image in .NET framework applications.
www.OnBarcode.com
Bar Code Decoder In Visual C#
Using Barcode decoder for .NET framework Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
de Complete
UPC - 13 Creation In VS .NET
Using Barcode creation for ASP.NET Control to generate, create EAN-13 image in ASP.NET applications.
www.OnBarcode.com
EAN13 Generation In Visual Studio .NET
Using Barcode creator for .NET framework Control to generate, create European Article Number 13 image in .NET framework applications.
www.OnBarcode.com
31. Layout and Style
GS1 - 13 Printer In Visual Basic .NET
Using Barcode creator for VS .NET Control to generate, create GTIN - 13 image in .NET applications.
www.OnBarcode.com
Data Matrix 2d Barcode Printer In Visual C#.NET
Using Barcode creation for .NET Control to generate, create DataMatrix image in .NET applications.
www.OnBarcode.com
Page 17
GTIN - 128 Maker In Visual C#.NET
Using Barcode printer for .NET Control to generate, create GTIN - 128 image in VS .NET applications.
www.OnBarcode.com
GTIN - 13 Generator In Visual C#.NET
Using Barcode drawer for .NET framework Control to generate, create EAN-13 image in .NET applications.
www.OnBarcode.com
In the example, the begin is placed at the end of the line rather than under the corresponding keyword. Some people prefer to put begin under the keyword, but choosing between those two fine points is the least of this style s problems. The endline layout style works acceptably in a few cases. Listing 31-22 is an example in which it works:
QR Code 2d Barcode Generation In C#
Using Barcode encoder for .NET framework Control to generate, create QR Code JIS X 0510 image in .NET applications.
www.OnBarcode.com
Draw UCC - 14 In Visual C#
Using Barcode drawer for Visual Studio .NET Control to generate, create UPC Shipping Container Symbol ITF-14 image in Visual Studio .NET applications.
www.OnBarcode.com
Listing 31-22. A rare Visual Basic example in which endline layout seems appealing.
EAN 13 Creation In Java
Using Barcode printer for Eclipse BIRT Control to generate, create EAN / UCC - 13 image in BIRT applications.
www.OnBarcode.com
EAN 13 Maker In None
Using Barcode creator for Microsoft Excel Control to generate, create European Article Number 13 image in Microsoft Excel applications.
www.OnBarcode.com
If ( soldCount > 1000 ) Then markdown = 0.10 profit = 0.05 Else markdown = 0.05 End If
Make Linear 1D Barcode In Visual Basic .NET
Using Barcode generator for Visual Studio .NET Control to generate, create 1D Barcode image in VS .NET applications.
www.OnBarcode.com
DataMatrix Creation In Visual Studio .NET
Using Barcode maker for ASP.NET Control to generate, create ECC200 image in ASP.NET applications.
www.OnBarcode.com
1 The else keyword is aligned with the then keyword above it.
Encoding Code-128 In VS .NET
Using Barcode encoder for ASP.NET Control to generate, create Code 128B image in ASP.NET applications.
www.OnBarcode.com
QR Creator In Objective-C
Using Barcode encoder for iPhone Control to generate, create Denso QR Bar Code image in iPhone applications.
www.OnBarcode.com
In this case, the Then, Else, and End If keywords are aligned, and the code following them is also aligned. The visual effect is a clear logical structure. If you look critically at the earlier case-statement example, you can probably predict the unraveling of this style. As the conditional expression becomes more complicated, the style will give useless or misleading clues about the logical structure. Listing 31-23 is an example of how the style breaks down when it s used with a more complicated conditional:
Bar Code Printer In Java
Using Barcode generation for Java Control to generate, create bar code image in Java applications.
www.OnBarcode.com
Code 39 Decoder In C#.NET
Using Barcode scanner for .NET framework Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Listing 31-23. A more typical Visual Basic example, in which endline layout breaks down.
If ( soldCount > 10 And prevMonthSales > 10 ) Then If ( soldCount > 100 And prevMonthSales > 10 ) Then If ( soldCount > 1000 ) Then markdown = 0.1 profit = 0.05 Else markdown = 0.05 End If Else markdown = 0.025 End If Else markdown = 0.0 End If
4 CODING HORROR
What s the reason for the bizarre formatting of the Else clauses at the end of the example They re consistently indented under the corresponding keywords, but it s hard to argue that their indentations clarify the logical structure. And if the code were modified so that the length of the first line changed, the endline style would require that the indentation of corresponding statements be changed. This
de Complete
31. Layout and Style
Page 18
poses a maintenance problem that pure block, pure-block emulation, and using begin-end to designate block boundaries do not. You might think that these examples are contrived just to make a point, but this style has been persistent despite its drawbacks. Numerous textbooks and programming references have recommended this style. The earliest book I saw that recommended this style was published in the mid-1970s and the most recent was published in 2003. Overall, endline layout is inaccurate, hard to apply consistently, and hard to maintain. You ll see other problems with endline layout throughout the chapter.
Which Style Is Best
If you re working in Visual Basic, use pure-block indentation. (The Visual Basic IDE makes it hard not to use this style anyway.) In Java, standard practice is to use pure-block indentation. In C++, you might simply choose the style you like or the one that is preferred by the majority of people on your team. Either pure-block emulation or beginend block boundaries work equally well. The only study that has compared the two styles found no statistically significant difference between the two as far as understandability is concerned (Hansen and Yim 1987). Neither of the styles is foolproof, and each requires an occasional reasonable and obvious compromise. You might prefer one or the other for aesthetic reasons. This book uses pure block style in its code examples, so you can see many more illustrations of how that style works just by skimming through the examples. Once you ve chosen a style, you reap the most benefit from good layout when you apply it consistently.
31.4 Laying Out Control Structures
For details on documenting control structures, see Commenting Control Structures in Section 32.5. For a discussion of other aspects of control structures, see s 14 through 19.
8 CROSS-REFERENCE
The layout of some program elements is primarily a matter of aesthetics. Layout of control structures, however, affects readability and comprehensibility and is therefore a practical priority.
Fine Points of Formatting Control-Structure Blocks
Working with control-structure blocks requires attention to some fine details. Here are some guidelines:
de Complete
31. Layout and Style
Page 19
Avoid unindented begin-end pairs In the style shown in Listing 31-24, the begin-end pair is aligned with the control structure, and the statements that begin and end enclose are indented under begin.
Copyright © OnBarcode.com . All rights reserved.