Reader small image

You're reading from  Mastering PLC Programming

Product typeBook
Published inMar 2023
PublisherPackt
ISBN-139781804612880
Edition1st Edition
Right arrow
Author (1)
Mason White
Mason White
author image
Mason White

M.T. White has been programming since the age of 12. His fascination with robotics flourished when he was a child programming microcontrollers such as Arduinos. M.T. currently holds an undergraduate degree in mathematics, a master's degree in soft ware engineering, and is currently working on an MBA in IT project management. M.T. is currently working as a soft ware developer for a major US defense contractor and is an adjunct CIS instructor at ECPI University. His background mostly stems from the automation industry where he programmed PLCs and HMIs for many different types of applications. M.T. has programmed many different brands of PLCs over the years and has developed HMIs using many different tools.
Read more about Mason White

Right arrow

The SDLC — Navigating the SDLC to Create Great Code

I didn’t realize until I was about halfway through my graduate degree that software engineering is so much more than just writing code. Sure, I had several years of experience under my belt, but the full notion of what software engineering was didn’t fully sink in until I took a class that focused on navigating the Software Development Life Cycle (SDLC). Luckily, I was in good company. While taking the class I realized I wasn’t the only one who viewed the notion of the SDLC as exotic. The idea was reinforced after I graduated and progressed to a point in my career where I was working with less-experienced developers. In short, I found during the first part of my career that many developers were not aware of the SDLC, what it stood for, or more importantly, what it was.

Software engineering is much more than developing great code. Like any other engineering discipline, software engineering is a process...

Technical requirements

The source code for this chapter can be found in the GitHub repo for this book. You can use the following URL: https://github.com/PacktPublishing/Mastering-PLC-programming/tree/master/Chapter%209.

We will also need some type of rendering software for drawing UML diagrams. For this chapter, I’m going to use draw.io for the rendering. If you prefer another piece of software, you are free to use it. Alternatives that you can use can include things like Google Charts, Visio, or any other software. You can use draw.io for free at the following link: https://app.diagrams.net/.

Understanding the SDLC

The SDLC is the steps in the software development process. In short, much like any other engineering process, the SDLC is the process that should be followed in some way to ensure you are correctly building the correct program. Depending on who you ask or what you read, the SDLC is usually broken down into the following:

  1. Gathering requirements
  2. Designing the software
  3. Building the software
  4. Testing the software
  5. Deploying the software
  6. Maintaining the software

Now, some models will only use five steps, and some will use more. However, no matter the model, the steps are the same, just broken out differently.

Why care about the SDLC?

To many PLC programmers, the SDLC is as exotic a concept as alien life is to astrobiologists. Sadly, this comes from the mentality that software is an unimportant component of automation. However, to properly implement the concepts that we have covered thus far and to take our PLC software to the...

Investigating the general steps of the SDLC

We have briefly touched on the steps of the SDLC. However, we have not dived into what they are or what they consist of. This section is dedicated to exploring the steps in the SDLC so we can implement them.

Requirements/planning

If you ask a person off the street or an inexperienced software developer what the most important aspect of developing software is, chances are, they will answer coding. It makes sense since software development is about developing software after all. However, two steps must be completed before you or another developer even thinks about touching a keyboard. The first of which is the requirements/planning phase. Some break this phase into two distinct phases while others simply call this an analysis phase. Regardless of whether you consider this a phase or phases, it is the backbone of the project. In short, without this step, you simply do not have a project. If the SDLC is a building, the requirements/planning...

Final project – creating a simple library

Now that we have explored the SDLC, we are going to apply what we learned and build a full project with those principles. The following section will be dedicated to building a temperature conversion library.

Gathering requirements for the library

As we have discussed in this chapter, the first thing we need to do is determine the requirements for the project. Our goal is to create a temperature converter similar to the one we built before. However, our library will need to be portable without the possibility of anyone modifying it. It will also need to convert between all temperature units. We can say our requirements are the following:

  • Should be a compiled library
  • Should convert Fahrenheit to Celsius and Celsius to Fahrenheit
  • Should convert Celsius to Kelvin and Kelvin to Celsius
  • Should convert Fahrenheit to Kelvin and Kelvin to Fahrenheit

We can write some use cases, such as the following:

  • As...

Summary

It is pivotal to understand the SDLC for anyone who wishes to write code. The SDLC should be thought of as a guide to properly develop software. No matter what you’re doing, you should always follow the SDLC as closely as you can so that your software will be easy to build, fix, and expand upon in the future.

This chapter has been a crash course in the SDLC, the methodologies that govern it, and the steps that it encompasses. Of all the chapters, I would argue that this is the most important. Too often, developers get caught up in what I like to call the code culture of just blindly building things with no roadmap of where they are, where they’ve been, or where they’re going. Being able to navigate the SDLC will set you apart from those developers as in-depth knowledge of the SDLC is what separates an engineer from a programmer. With these principles under your belt, you can build software that will be extraordinary.

At this point, you should have...

Questions

Answer the following questions based on what you've learned in this chapter. Cross-check your answers with those provided at the end of the book, under Assessments.

  1. What is code coverage?
  2. How much code coverage should you be shooting for?
  3. If you have 100 lines of code and you test 50 lines, what is your code coverage? Is it enough?
  4. Define the SDLC.
  5. How many steps are in the SDLC?
  6. What is UML?
  7. What is the difference between regression testing and unit testing?
  8. What is a test case?
  9. What is validation and what is verification?

Further reading

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering PLC Programming
Published in: Mar 2023Publisher: PacktISBN-13: 9781804612880
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Mason White

M.T. White has been programming since the age of 12. His fascination with robotics flourished when he was a child programming microcontrollers such as Arduinos. M.T. currently holds an undergraduate degree in mathematics, a master's degree in soft ware engineering, and is currently working on an MBA in IT project management. M.T. is currently working as a soft ware developer for a major US defense contractor and is an adjunct CIS instructor at ECPI University. His background mostly stems from the automation industry where he programmed PLCs and HMIs for many different types of applications. M.T. has programmed many different brands of PLCs over the years and has developed HMIs using many different tools.
Read more about Mason White