In the career of a programmer, there are a variety of situations in which people are examined, whether they are changing jobs or being promoted. As software development experience continues to accumulate, the requirements and requirements of these tests gradually become higher.

Working years will not be used to judge whether a candidate is qualified or not, because after all, three years of CRUD business and three years of system research and development work experience and work quality are very different, so there are not small problems, especially when recruiting senior development engineers. In algorithmic interviews, too, it’s hard to tell if a candidate came up with an answer on the spot or memorized it. Traditional eight-part essay, algorithm, cutting-edge technology source code and other knowledge content is no longer new, and some “soft skills” like system design interview will be examined in a more important part of the link.

To make the interview more effective, it is a good idea to use the system design questions to examine senior development engineers. Because the system design topic covers a wide range, unlike the algorithm topic circulated around the Internet, candidates want to brush can not brush, can only spell technology.

These soft skills do not look directly at a single knowledge point or the areas of knowledge connected by a single piece of knowledge. Rather, they look at the depth of an engineer’s overall knowledge and understanding of application design. This kind of problem is not like algorithm problem spread around the Internet, want to brush the problem also can’t brush, can only spell technology. Although it will not involve a knowledge point, such as a control is how to achieve and say the internal implementation principle, but will let talk about the advantages of this control or how to improve on the original basis;

This will make the whole process more efficient, and the interviewers will be able to accurately judge the technical strength of the candidate, and at the same time, give the right salary and grade.

In the interview system design questions, and how to evaluate the candidate? For this, you can refer to the summary below.

In this article, I’ll share my tips on how to answer a design question from a client and how I’ve solved it. Sound like fun? … keep reading

The issues involved in system design issues

Eason watched a lot of video tutorials on different types of system design and made some summaries about this aspect. I think these summaries are not only applicable to system design, but also another requirement for his own technology stack and a way to check and fill gaps. Here’s a rundown of the aspects of programming that must be considered:

1. Functional requirements — You first need to define the use cases and functionality of your application.

2. Non-functional requirements — Define performance, experience, and scale requirements.

3. Assumptions — define the boundaries of the problem, any size constraints, characteristics, etc.

4. Client-server communication – Define connection options such as HTTP requests, polling, server-side events.

5.API design — Define the function endpoints to be built.

6. Data Model — Define the data model fields of the object.

7. Application Flow (Use-case flow) — the user flow that defines and executes the functionality being designed.

8. Performance and Tools – Defines how you will collect data and metrics to see the performance of your application – memory utilization, CPU utilization.

9.ADA — Make sure you define accessibility and accessibility of your application.

10. Internationalization — As the application grows internationally, the international adaptation of the system application needs to be handled.

11. Security – Defines how applications are protected.

The specific implementation

Now, let’s use an example to illustrate why these structures are needed to design a system: Suppose the problem is that you are asked to design an App that presents interesting anecdotes in everyday life;

1. Functional requirements

Displays a list of interesting places around me.

Scroll down to load more

2. Non-functional requirements

The list should load very quickly or have low latency

Scroll to performance

Data is loaded asynchronously and the display should not be misplaced

The list should not jitter

3. Suppose

How many active users do you have per day? What is the user level?

Is the API available? We need to use them wisely

4. Client-server communication

Regular HTTP requests – This is the most common use case scenario where a client requests data/resources from a server. For example, what is the typical polling approach to get a list of feed items in a feed?

Periodic polling – The client can constantly make requests to the server for the latest information, but many times the server may not have any updates available. Not only does this result in an empty response most of the time, but it also wastes resources setting up HTTP connections multiple times.

Long polling – If we have a use case, we know that content will not be updated frequently from the server. In this case, what we can do is use long polling. The client establishes an HTTP connection with the server and keeps the connection open so that the server can push updates to the client if there are any pushes. This saves us the useless work of opening and closing connections to the server. And keep in mind that this long polling connection can also time out, so you need to restart the connection in that case.

WebSockets – We can use WebSockets in situations where both the client and the server can initiate communication and there is a constant back-and-forth between the client and the server. A good example of this use case is a chat application.

Server-side events (SSE) – The client establishes a persistent and long-term connection to the server. The server uses this connection to send data. The client is in listening mode because only the server can communicate with the client. If the client needs to communicate with the server, it needs to use a different protocol. This use case says that we have a social media application that lists friends’ feeds. But now, if updates have just occurred while we are using the application, the client can easily get those updates through the server-side event (SSE) protocol.

5. API design

Apis communicate with each other through protocols. Common protocols are SOAP, REST, and GraphQL. Details on these are not part of this article, but you can expand on them if you are interested. REST should be fine for our App that shows what we’re interested in, and it should work for most scenarios. According to our requirements, we need to design the following types of apis:

A) We need a list of locations

B) Since we list nearby locations, one thing we can think of is that the API call needs some kind of location information to return data, and it could be our query parameter.

C) paging. Given that this is a mobile application and we don’t have unlimited resources like computing/connections and power like a desktop or laptop, we need to be careful about the amount of data we get and not load it all at once or pull it down. Therefore, it is best to get the data in chunks and get more data as needed. So we need to be able to paginate requests for data, and that’s where pagination comes in. Offset, KeySet, and Cursor Based are different types of paging server support. For our use case, we can choose any of them. But I personally prefer to use offset pagination. So we have a page number and page limit to limit the number of resources. Given that, our API might look something like this, right?

The GET – / places? lat={}&long={}&page={}&pageLimit={}

6. Data model

When designing a system model, the infrastructure must be fixed first, such as the system application is the high-rise, the data model is the foundation; In this article, I’ll show you how to make an efficient and meaningful underlying data model. Considering the functionality involved in the overall requirements, the data model is designed as the following diagram (simplified model)👇

7. Application process

The following are any of the design architecture patterns that we may need.

Can be:

  • MVC — Model view controller
  • MVVM — Model view View model
  • MVP — Model View Presenter
  • 9 etc.

For generally simpler use cases, I use MVVM more often. We should use common and meaningful patterns in our daily life, and we can also adopt the same way to apply the past in our work, so as to improve work efficiency and reduce the time to build wheels.

Performance of 8.

This section can be used to address non-functional requirements and any other performance-related aspects, because it is an important part of the review, so I will take it back and talk to you. What are the methods in App design that can be used to improve application performance?

  1. Layout optimization:
  • Remove useless controls and layers from the layout, and selectively use viewgroups with low performance.
  • It takes tag, tag,ViewStub.
  • Avoid overdrawing
  1. Rendering optimization:
  • Do not create new local objects in onDraw.
  • Do not do time-consuming tasks in the onDraw method, the loop execution method is very occupy the CPU time slice, this will cause the View drawing process is not smooth
  1. Memory leak optimization:
  • Avoid writing code with memory leaks during development
  • Use analysis tools such as MAT to identify potential memory leaks and fix them.
  1. Response speed optimization: The core idea of response speed optimization is to avoid time-consuming operations in the main thread.

  2. ListView/RecycleView and Bitmap optimization

  • Use the ViewHolder pattern for efficiency
  • Asynchronous loading: Time-consuming operations are placed in asynchronous threads
  • ListView/RecycleView slide stop loading and pagination loading
  • Compress loaded images to avoid OOM appearance due to the size of loaded images.
  1. Thread optimization: The idea of Thread optimization is to use Thread pools to avoid having too many threads in your program.

  2. Other performance optimization suggestions

    â‘  Show Skeleton – The perception that something is loading makes the user feel that the data is loading faster. Showing some skeletons when loading data can have a huge impact on perceived user experience

    â‘¡ Use images with appropriate dimensions. If the API supports height and width as query parameters, you will get results that make sense for the image display. The user’s eye can’t tell the difference between image sizes, but it can have a huge impact on application performance because it loads less data.

    â‘¢ Use content delivery Network (CDN) for still image caching to help deliver content faster. In our App, CDN is used for images and static content, and location description text and images are cached to the cloud.

    (4) Load data on background threads so that the main thread never blocks and the UI never gets stuck.

These are some of the most common ways to optimize performance, but there are others you can explore actively during the interview.

9. Accessibility

We always want everyone to use our application. For it to be truly inclusive, we need to address accessibility in our application. Here are some things we can do to address accessibility issues:

  • Make sure the color contrast is correct
  • Each target size should be at least 44pt
  • Add custom calls for accessibility annotations
  • Use an appropriate color scheme
  • Dynamic font types are supported
  • Use automatic checks on libraries such as GTXilib so that they can ensure that each UI element has a label, appropriate characteristics, and tags are not redundant.

The practices mentioned above can be applied to any mobile application. You can also read more about accessibility on Google and Apple.

10. Internationalization/localization

The internationalization of an application provides a local and personal experience for its users, which is helpful for application usage and adoption. In general, we can support this by using different localized string files called strings.xml for the content/text in the application.

You can also use advanced techniques, such as sending device locale Settings to the server, which then returns localization files. Depending on your needs, you can take different paths to localize, which is Google’s official guide to localization.

11. The security

Security is a very broad and complex topic. As mobile application developers, you need to learn and follow some tips and tricks in your daily work:

  • Use signing and encrypting data
  • Compilation and decompilation
  • NDK and disassembly
  • Shell and shell

conclusion

The point of systems design is to examine our ability as engineers to look at/understand application design as a whole, not just the details of individual knowledge points or facets. There is no optimal solution for system design, because there is no perfect answer.

/ Thanks for your support

That is all the content of this sharing. I hope it will help you

Don’t forget to share, like and bookmark your favorite things

Welcome to the public number programmer bus, from byte, shrimp, zhaoyin three brothers, share programming experience, technical dry goods and career planning, help you to avoid detours into the factory.