Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Vim anti-patterns

The benefits of getting to grips with Vim are immense in terms of editing speed and maintaining your “flow” when you’re on a roll, whether writing code, poetry, or prose, but because the learning curve is so steep for a text editor, it’s very easy to retain habits from your time learning the editor that stick with you well into mastery. Because Vim makes you so fast and fluent, it’s especially hard to root these out because you might not even notice them, but it’s worth it. Here I’ll list some of the more common ones.Moving one line at a timeIf ...

3,130 0       VIM MACRO SYNTAX ANTI-PATTERN


  Introducing the for-if anti-pattern

Over the years, I've seen a bunch of coding anti-patterns.I figured maybe I'll share a few.Today, I'll introducewhat I'm calling the for-if anti-pattern,also known as"We'll sell you the whole seat, but you'll only need the edge."This is a special case of the for-case anti-pattern, whereall but one of the cases is null.for (int i = 0; i < 100; i++) { if (i == 42) { do_something(i); }}This can naturally be simplified todo_something(42);The for-if anti-pattern arises in many forms.For example:foreach (string filename in Directory.GetFiles(".")){ if (filename.Equals("desktop.ini", StringCom...

3,024 0       PROGRAMMING EFFICIENCY ANTI-PATTERN FOR-IF