[Java] Tasks that are often given to fledgling engineers

4 minute read

One year since becoming the manufacturer’s in-house SE

Hello, this is Hikaru. I joined a certain manufacturer as an in-house SE. I didn’t do any programming when I was in college, so I put a lot of knowledge into the training after joining the company. This time, I will introduce some of the tasks I received from my seniors on the spot. I thought that this kind of “job for beginners” is similar in any workplace, so I hope it will be helpful. In addition, my workplace is Java, language is Struts, template engine is Struts, build tool is Ant, version control is CVS, and I have a legacy environment.

① Increase the number of input items on the screen and register it in the DB.

Senior: “I received a request from a user to be able to add inventory categories for products, so please implement it.” The first year I “Yes (white eyes)”

It’s a common task. It is an implementation that increases the input items on the screen and registers it in the DB. This task requires the following knowledge:

  • ** Mechanism for linking html and template engine **
  • How to use O/R mapper that persists values in DB

For beginners, I can’t hear words like template engines or O/R mappers. To put it plainly, The template engine is a mechanism to bring the value input on the screen to the next screen, and The O/R mapper is a mechanism to connect the input value to the database.

❖ Without these two, the contents that the user typed in will disappear completely when the next screen is displayed, and even if you press the register button, the contents will not be reflected in the database.

In other words, you should understand and understand the basics of typical CRUD processing. To do so, we recommend that you try making a simple application yourself. Now you can learn as much as you want with Qiita or Udemy, and why not take a copy of the code and feel the joy of working. The knack for learning is to understand after the program is running. If this is the other way around, the output will be delayed and you will not be able to acquire practical power. Maintaining motivation is also difficult.

I think it is good for a fledgling engineer to focus on and learn such a “mechanism for holding the values on the screen”. Okay, I didn’t understand it at first, but now I’m trying to remember how it works.

② Please make a validation so that the user does not input by mistake.

Senior “There are many cases where the user inputs an incorrect value. To prevent this, please provide a check function before transitioning to the next screen.” The first year I “Yes (white eyes)”

This check function is very important. Because users are humans, they don’t always make the right input on screen. For example, the product name may be entered as “HOGEHOGE2012”, but OGEHOGE2012” without the leading H.

Then how can we prevent it?

I said “HOGE HOGE 2012” where you should enter. In other words, the input should have been correct. This means that you can register the correct answer on the system in advance, and match the correct answer with the input depending on the time and case.

Establishing validation is a basic part of system development, but what is important is how to define the correct answer standard in the application. Speaking of the product name above, the correct product name ** “HOGEHOGE2012” ** is registered in advance in the master (≒ template), and when entering it, the correct answer is compared with the content. Then, if something goes wrong, I don’t think “OGEHOGE 2012”! Display ** and error. The user then notices the mistake.

Specifically, search the database by product name, and if there is no hit, it is an error. Even if it hits, if it is not the data to be input on that screen, an error is still issued. For example, in this process, HOGEHOGE2012 is the correct answer, and FUGAFUGA2019 is incorrect. In order to make that judgment, it is necessary to link the process with the product in advance.

However, if you do that, it is safe to pull the required value (product name) from the database and select it in the pull-down format. This time, I focused on validation, so I ignored that method…

If you are a beginner, it is important to understand how to use If statements and the characteristics of types, but please also pay attention to where to draw the correct answer.

At the end

I think that beginners are tough and full of things that they do not understand. I’m still that way (laughs)  But, when I understand it little by little, my horizons expand, and I can convince myself, “Oh, that’s what happened.” Please do not give up until then!