Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 1.89 KB

ANTIPATTERNS.md

File metadata and controls

43 lines (27 loc) · 1.89 KB

Anti-patterns

An anti-pattern is a common response to a recurring problem that is usually ineffective and risks being highly counterproductive.

We should always strive against creating antipatterns in our code.

Global Variables

Do not use global foobar in Python. Instead use the Global Object Pattern.

Read More

File Extensions

Use an extension that matches the contents

Here is an example where the extension and filename misleads the reader to assume the file contents follow a packet capture format, however, the contents are instead an ASCII dump and the file is not readable by Wireshark.

wlanpi@wlanpi:/tmp $ file lldpneightcpdump.cap
lldpneightcpdump.cap: ASCII text

What's wrong with this? The file extension is misleading.

The better file extension in this example would be .txt or similar rather than .cap. It better represents the contents.

A file with extension .cap should have contents similar to this:

wlanpi@wlanpi:~ $ file test.cap
test.cap: pcap capture file, microsecond ts (little-endian) - version 2.4 (Ethernet, capture length 262144)

Read More