The Daily WTF
Follow
Representative Line: Readable Formats
Format strings are preferred over concatenation for generating human-readable text. Some developers, however, still mix string concatenation with format strings. This can lead to complex and less readable code, as illustrated by an example involving dynamic decimal place formatting. The author argues that a simple variable for formatting would be clearer. The text also discusses the per-mille format specifier in .NET. The author finds using Unicode characters directly in code for such specifiers, like '\u2030', to be particularly confusing. This method of embedding formatting logic within string concatenation is deemed problematic. Ultimately, the goal of readable code is compromised by these practices. The author suggests simpler approaches for achieving dynamic formatting.