- #EXAMPLE OF A PUMP LADDER LOGIC PROGRAM HOW TO#
- #EXAMPLE OF A PUMP LADDER LOGIC PROGRAM FULL#
- #EXAMPLE OF A PUMP LADDER LOGIC PROGRAM SOFTWARE#
… of course I could write this: Console.WriteLine("1") If I asked a C# programmer to write this, they’d likely write something like this: for(var i = 1 i <= 5 i++) Imagine if you have to print the numbers from 1 to 5. First of all, satisfying #3 implies you must have satisfied #2, so ease of understanding is doubly important, and secondly, satisfying #3 implies you can predict what will change. Making it easy to make changes when the requirements change.Making it obvious to the reader what the program does.Don’t they ever wonder, “why is it so important to remove duplication from our code?” Should we really worry about saving a few bytes or keystrokes? NO! We focus on: That’s because programmers who believe the OAOO principle is about removing duplication are idiots too.
#EXAMPLE OF A PUMP LADDER LOGIC PROGRAM FULL#
So how can you blame them? God said, “let there not be duplication in software,” and ladder logic is full of duplication, thus ladder logic is the spawn of Satan. This principle is why PC programmers look at ladder logic and instantly feel disgust.
#EXAMPLE OF A PUMP LADDER LOGIC PROGRAM SOFTWARE#
This is one of the most fundamental principles of software development, to the point where it’s followed religiously. The OAOO principle focuses on removing duplication from software. For loops are one of many tools for following the Once and Only Once (OAOO) Principle of software development. What I do know, however, is that for loops solve a much more important problem than saving you keystrokes. Don’t get me wrong, I was an idiot about this too, and I’m still an idiot about most things. The first time you show a new programmer a “for” loop, they think, “Amazing! Instead of typing the same line out a hundred times, I can just type 3 lines and the computer does the same thing! I can save so much typing!” They think this because they’re still an idiot. Unfortunately, a carpenter with twice as many tools in her tool box is simply twice as likely to pick the wrong tool for the job if she doesn’t understand the problem the person who invented that tool was trying to solve. Decades of computer science has given us some amazing tools. Everyone wants that simple rule of thumb, but it’s far more valuable to understand the first principles so you can apply that rule intelligently. I spend a lot of time trying to get people to think about why they do things a certain way. Why would I, an experienced programmer, choose to write programs like an 8 year old? Do I know something they don’t? Still, I choose to write simple and straightforward ladder logic.
#EXAMPLE OF A PUMP LADDER LOGIC PROGRAM HOW TO#
The thing is, I know how to use loops, arrays, and subroutines, not to mention object oriented programming and functional programming constructs like s-expressions, closures and delegates. To them, this means you’re programming at the level of an 8 year old.
The real reason they hate ladder logic is because ladder logic programmers avoid things like loops, indexed addressing and subroutines. Let’s ignore the fact that most traditional programmers just don’t grok ladder logic at all, because their minds think about programs sequentially rather than in parallel. I have one foot in each world, and yet I choose to write C# programs one way and ladder logic programs another.
NET developer and a ladder logic programmer, this has caused me a lot of frustration and confusion over the years. When traditional PC programmers see ladder logic, they think ladder logic programmers are terrible programmers.