[Python] What a programming inexperienced person did before creating a tool

Introduction

I'm currently in my second year as an engineer, but in my first year I actually made a tool from the request "I wish there was such a tool". The tool I created is here. It's the same as it was at that time, so I think there is room for unknown defects and refactoring. For inexperienced people who are thinking of making deliverables from now on How I made the tool while I was inexperienced at that time I thought I'd leave it in this article to let you know. I hope it will help the inexperienced people on the road to development.

The process of making a tool

From the next section, we will look at each item.

Score a goal

When actually making a tool (deliverable product), decide "what is the goal". It is a good idea to set a deadline.

Try to create csv

I wanted to know what kind of csv will be output when the tool is completed, so First, I created csv manually. By doing this, I understood the following.

WBS creation and verification

I don't think it's necessary unless you have a fixed period for creating the tool. However, when it comes to "at work", there are almost no jobs for which the period (delivery date) is not fixed. You may think that it will become.

Selection of programming language to use

Some programming languages are suitable for making something. This time I decided to use Python, which was unlikely to make a difference and had qualifications.

Determining how to use the tool

Not all users who actually use the distributed tool have an environment in which this tool can be used. You must specify how to prepare the environment so that it can be used by that user, or make it available without preparing the environment. At the time of development, we aimed at the former. (It was later supported so that it can be used even if the environment is unnecessary.)

Algorithm determination

What I found when I created csv as a trial is dropped as it is as an algorithm of the tool. For example, try to create a CSV based on the following information.

sample.txt


set address "Trust" "192.168.1.103/32" 192.168.1.103 255.255.255.255
set address "Untrust" "200.200.200.200/32" 200.200.200.200 255.255.255.255
~(Omitted)~
set policy id 3 from "Trust" to "Untrust" "192.168.1.103/32" "200.200.200.200/32" "SNMP" permit log
~(Omitted)~

Here's what I found out:

We will use this as an algorithm.

Preparing the programming environment

This time I prepared the following.

Environmental preparation is described in here. Also, it will change depending on the language etc., so I will omit it. Development has started here.

WBS review

I think there are phases that are more advanced than I expected during development, or phases that are not. You can write test code and refactor in the phase when you can afford it, On the other hand, what to do when a phase that is not so comes out Around this time, I felt that it became important for me to work in the future.

Operation check

Make sure that what you implement according to the algorithm works as expected. If it works as expected, otherwise ... fix it. Addition of algorithm to deal with exceptions that did not work as expected in the operation check It may be necessary to modify the existing algorithm. If you can't fix it properly here, you may see hell (see below).

Test code refactoring

By correcting the part that did not work as expected in the operation check, the part that worked until now I think that it may not work properly (degration). I have degrated as it is ... If you have test code, you will notice it immediately when you degrease, At worst, you will notice if you are debugging with print etc. It may not be worth the time to write the test code, so the scale of the product you are trying to make, I think it is better to decide whether to write according to the frequency of maintenance. (Unless you want to write test code for the first time)

Regarding refactoring, I did it based on Read the readable code. It was very helpful for me to name the function and make it a highly versatile function. I also used flake8 and radon.

Q&A

Q. Do you not study programming languages in advance? A. I have not studied anything above the qualification in advance. I learned while using it when I needed it. Example: I want to output csv with python → Guguru → Know that there is a library called pandas → Learn how to use pandas I studied with a qualification ≠ because there is a possibility that I can use it in practice I don't think the starting point is that much different from unlearned people. (Although it's better to study)

Finally

At first, you may think about what to do, etc. I think it is important to "try it for the time being". The experience of "creating one product from zero" at that time I feel that it is useful for the current development work. "Let's start here, from scratch ... No, from scratch."

Recommended Posts

[Python] What a programming inexperienced person did before creating a tool
[Python] Creating a scraping tool Memo
What I did with a Python array
Creating a scraping tool
Problems when creating a csv-json conversion tool with python
[Python] Dynamic programming TDPC A
What is a python map?
A note on what you did to use Flycheck with Python
Precautions when creating a Python generator
[Python] Chapter 03-01 turtle graphics (creating a turtle)
Creating a simple PowerPoint file with Python
What kind of programming language is Python?
Creating a python virtual environment on Windows
What is a dog? Python installation volume
Memo for creating a text formatting tool
[Python] Creating a stock price drawdown chart
A tool for easily entering Python code
Try a functional programming pipe in Python
Learn dynamic programming in Python (A ~ E)
I created a password tool in Python.
python: Creating a ramen timer (pyttsx3, time)
What I did to save Python memory
Creating a Python document generation tool because it is difficult to use sphinx
I tried to implement what seems to be a Windows snipping tool in Python