Author: Cody J., Inflow Software Engineer
Should everyone know how to program? To the extent of having the equivalent of a computer science degree, no. However, a basic level of knowledge will serve many people well, especially managers.
This idea isn’t new; the Huffington Post wrote about it a few years ago, and others wrote about it even earlier. The main reason that people should understand the basics of programming is because of the invasiveness of computers; everything is computerized nowadays and will only increase, especially as devices are connected to the Internet.
Being computer illiterate should not be considered a badge of honor; too many people, from doctors to politicians and beyond, seem to take pride in not knowing the basic functionality of computers. While writing full-blown applications isn’t something everyone needs to know, managers (especially in the tech world), should know the basics. That way, they can feel more comfortable when talking to the “tech-heads”, as well as being able to have a better understanding when developers talk about how hard something is and how much time it will take.
So, what should managers know about code? Here’s a brief list of concepts that will at least help them understand the lingo:
● Data structures: these are logical structures (typically) built into the programming language. They allow data to be organized in an efficient manner for ease of programming. Some languages have more primitive structures that can be used by programmers to make their own data structures.
Each language has its own data structure implementation, though they may be similar across different languages. For example, many languages have the capability of mapping a keyword to a value (each value can be retrieved by simply supplying the keyword); these structures may be called associative arrays, hash tables, dictionaries, etc., but they all provide the same capabilities.
● Conditional statements: Most frequently seen as “if/else” statements in code, conditionals allow the programmer to branch the code flow depending on certain conditions. For example, if “condition A” is true, then perform “action A”; else perform “action B”.
● Loops: Loops simply repeat a block of code a certain number of times until a set stop condition is reached. Once reached, control returns to the main program.
Loops can be set to repeat a certain number of times (count-controlled), to continue until a particular condition is met (condition-controlled), and (in some programming languages) loops can operate over a collection of values in a data structure (collection-controlled).
Infinite loops are generally considered a bad programming practice, as they will run forever until forced to stop, typically by user intervention. However, there are times when infinite loops are necessary for operation, such as an event-monitoring program that looks for and processes events (like an operating system), or an interactive program that continually waits for user input before doing something.
● Exceptions: Exception handling is simply dealing with errors in code. When a program acts in an unexpected manner, an error is generated, i.e. an exception to the normal program flow. Programmers can add code to a program to catch these exceptions, allowing the program to continue functioning without crashing (hopefully).
Obviously, not every anomalous condition can be accounted for (which can result in program and system crashes), but programmers work hard to identify as many error-causing conditions as possible. Frequently, these errors are automatically captured by the software and sent back to the programmers. These notifications are used to create new patches for the software.
● Functions: Sometimes called subroutines, functions are frequently the workhorses of programs. Essentially, they branch off from the normal logic flow in a program to perform specific actions, then return control back to the main program flow. Functions are simply containers of code-logic that can be used multiple times within a program, simply by using the function’s name.
The main benefit is that, without functions, you have to copy and paste the same code blocks multiple times to make your program work, i.e. your program runs from start to finish in a straight line, so to repeat a particular action, you’ll have to manually repeat it every time. If you ever have to revise the program, going to one location to make the change is much easier than finding all the different locations if you copy and pasted it.
When used in classes (explained below), functions are called methods to signify it is being used with objects.
● Classes: Object-oriented programming (OOP) is one of the most common paradigms currently used in programming. Most OOP languages uses classes as their main data structure.
The main idea behind classes is that they can be used to create a generic base class, which can then be subclassed to create specific objects. For example, you could have a generic class of Vehicle. This base class has parameters that define a vehicle, e.g. the number of wheels, the type of frame, number of doors, etc. Using this Vehicle class, you could make subclasses that inherit from Vehicle, such as Bicycle, Car, Pickup Truck, Airplane, etc.
When you make a subclass, you simply provide the details for the new object as input values for the generic parameters. For example, for a Car subclass, you give it “4 wheels”, “4 doors”, “steel frame”, etc. For a Bicycle, you give it “2 wheels”, “0 doors”, “aluminum frame”, etc.
The idea behind classes is that they can be easily reused or, via inheritance, they can be extended into specific subclasses. They also let you model real-world items more accurately. In short, a class lets you create a basic template and default behavior for something, when can then be used as a foundation for more specific changes.
● Unit tests: Testing of software is an important part of quality assurance, ensuring that the application is ready for use without any significant bugs. Unit testing is designed to create a test situation for each block of code; the code block could be an entire program, but is more often the components of the program, such as a function or a class.
A variety of techniques are used to create unit tests and, ideally, each unit test is separate from the others to ensure modularity of the code blocks. The benefits of testing are: detection of problems early in the lifecycle, ease of future modifications and integration into larger programs, and support of software documentation and design.
There are obviously a number of other topics to be covered in programming, some more advanced than others. Hopefully, however, this is enough to give non-programmers some insight into what is involved in writing software and why it may take longer to get a project finished. There are a number of tutorials available on the Internet, as well as boot camps and actual academic degrees, but understanding the basics should make the life of a manager easier. Programming can be helpful in automating a number of tasks, which, in itself, should encourage people to pick up the basics so they can get to the more enjoyable parts of life.
At Inflow we solve complex terror and criminal issues for the United States Government and their partners, by providing high quality and innovative solutions at the right price through the cultivation of a corporate culture dedicated to being #1 in employee and customer engagement. We Make it Matter, by putting people first! If you are interested in working for Inflow or partnering with us on future projects, contact us here.