I made a question that can be used for a technical interview

Target audience

I want to have a technical interview for an engineer educator, but I can't think of a good question.

Target position

--Tech lead to improve the productivity of the development team --Software development and education staff who are also in charge of programming education and code review

background

--An interface written without knowing the benefits of the interface will not bring that benefit ――The goodness is not reflected in the program written without understanding the key of the language specification.

Purpose of the question

Confirmation of whether the design can be designed with development efficiency and maintenance efficiency in mind, and whether the code can be discussed with engineers for design and code improvement.

Question 1

  1. What are the benefits of abstracting a class?
  2. Why should classes rely on abstraction rather than concreteness?
  3. Please explain the specifications of polymorphism and its purpose.

Question 2

  1. Please improve the following code by refactoring
  2. Please explain the points of improvement and their benefits.

Code (Java)

python



public interface InterfaceA {	
	String search(String key);
	String delete(String key);
	String insert(String key);
}

public class ServiceA implements InterfaceA {
	@Override
	public String search(String key) {
		return null;
	}

	@Override
	public String delete(String key) {
		return null;
	}

	@Override
	public String insert(String key) {
		return null;
	}
}

python


public class ServiceController {

	private static ServiceA objA;
	private static ServiceB objB;
	private static ServiceC objC;
	
	public static void set(ServiceA obj) {
		objA = obj;		
	}
	
	public static void set(ServiceB obj) {
		objB = obj;		
	}
	
	public static void set(ServiceC obj) {
		objC = obj;		
	}
	
	public static void search(int serviceType, String key) throws Exception {
		if(1 == serviceType)	 objA.search(key);
		else if(2 == serviceType)objB.search(key);
		else if(3 == serviceType)objC.search(key);
		else throw new Exception("Error");
	}
	
}

python


public class Provider {

	public static void init() {		
		ServiceController.set(new ServiceA());
		ServiceController.set(new ServiceB());
		ServiceController.set(new ServiceC());		
	}

	public static void searchA(String key) throws Exception {
		ServiceController.search(1, key);
	}
}

Summary

These are the questions for code reviewers and educators.

Recommended Posts

I made a question that can be used for a technical interview
I made a THETA API client that can be used for plug-in development
[Android] I want to create a ViewPager that can be used for tutorials
Create a page control that can be used with RecyclerView
I made a plugin for IntelliJ IDEA
I made a class that can use JUMAN and KNP from Java
I made a Diff tool for Java files
Organize methods that can be used with StringUtils
[Ruby] Methods that can be used with strings
A collection of RSpecs that I used frequently
Technology excerpt that can be used for creating EC sites in Java training
I made a Docker image of SDAPS for Japanese
I made a check tool for the release module
Write a class that can be ordered in Java
I made a method to ask for Premium Friday
I made a library that works like a Safari tab !!
I made a library for displaying tutorials on Android.
I made a Wrapper that calls KNP from Java
About the matter that hidden_field can be used insanely
I used Docker for my portfolio as a beginner, so I hope that even 1mm will be helpful to someone.
Convenient shortcut keys that can be used in Eclipse
I tried a puzzle that can only be solved by the bottom 10% of bad engineers
I made a reply function for the Rails Tutorial extension (Part 4): A function that makes the user unique
Summary of css selectors that can be used with Nookogiri
Create a jar file that can be executed in Gradle
Firebase-Realtime Database on Android that can be used with copy
Problems that can easily be mistaken for Java and JavaScript
[Question] Can nullif be used in the count function in JPQL?
Find a Switch statement that can be converted to a Switch expression
I made a mod that instantly calls a vehicle with Minecraft
Programming can be a god.
I made a chat app.
Object-oriented design that can be used when you want to return a response in form format
I can no longer connect to a VM with a Docker container that can be connected via SSH
Static analysis tool that can be used on GitHub [Java version]
Mechanism for converting to a language that the browser can recognize
Summary of ORM "uroboroSQL" that can be used in enterprise Java
I made a reply function for the Rails Tutorial extension (Part 1)
I made a source that automatically generates JPA Entity class files
I made a method to ask for Premium Friday (Java 8 version)
Power skills that can be used quickly at any time --Reflection
SwiftUI View that can be used in combination with other frameworks
I made a reply function for the Rails Tutorial extension (Part 5):
Mecab installation that can be done almost by typing a command
A story that I finally understood Java for statement as a non-engineer
[Java 8] Until converting standard input that can be used in coding tests into a list or array
How to override in a model unit test so that Faker can be used to generate random values
I implemented the multiple image upload function in Rails so that multiple images can be slid for the post
[Spring Boot] List of validation rules that can be used in the property file for error messages
Ruby: I made a FizzBuzz program!
I made a shopify app @java
I made a simple recommendation function.
I made a matching app (Android app)
I made a package.xml generation tool.
[Android] I made a pedometer app.
Java file input / output processing that can be used through historical background
Maybe it can be used at a year-end party? Mosaic game code
I tried learning Java with a series that beginners can understand clearly
Simple slot machine implementation that can be used with copy and paste
I was in trouble at work, so I made a plugin for IntelliJ
Java code that cannot be used from Kotlin (for in-house study sessions)