Writing year-end summary every year is really nothing new. Although I made a summary this year, I always felt too pessimistic after writing it, but at the end of the year, I should have something to express, thinking that this year is the year to change, so I came up with this article “2020, SEVERAL good things I encountered in programming”.

This article introduces, there are frameworks, tools, software, are in their own programming encountered useful, and their favorite, here to share with you. Is the so-called encounter is fate, if you are lucky enough to read this article and feel good, might as well like attention to support a wave.

Hutool

Hutool is a Java toolkit that encapsulates JDK methods such as files, streams, encryption and decryption, transcoding, re, threads, XML, etc., and forms various Util utility classes. His role is to help us simplify the code so that programmers spend more of their time on the business and less on irrelevant tasks.

For example, RECENTLY I had a small demand. There were many small folders in a large folder, and each small folder contained some Word documents THAT I needed to sort out. If I clicked on it through the interface, I might need to click on more than 100 folders, so it was natural for me to use the program to realize this demand. The first thing you might think of is a shell script or a Python script, but hutool and Java8 lambda expressions can also be used to implement this little requirement, as shown below:

public class Main {
    public static void main(String[] args) {
        List<File> files = FileUtil.loopFiles("xxxPath", file ->
                FileUtil.extName(file).equalsIgnoreCase("docx") || FileUtil.extName(file).equalsIgnoreCase("doc")); files.forEach(file -> FileUtil.copyFile(file.getAbsolutePath(),"xxxxxPath", StandardCopyOption.REPLACE_EXISTING)); }}Copy the code

Using fileutil. loopFiles, you can directly obtain all files in this path. To filter, you only need to append parameters. There are many such utility classes, such as mailUtil.send.

MailUtil.send("[email protected]"."Happy New Year"."Pay attention to" 01 binary, "now pay attention to later will be old fans.".false);
Copy the code

The installation method is also very simple, Maven installation

<dependency>
    <groupId>cn.hutool</groupId>
    <artifactId>hutool-all</artifactId>
    <version>5.5.6</version>
</dependency>
Copy the code

If you are using Gradle, do the following configuration

compile 'cn. Hutool: hutool -all: 5.5.6'
Copy the code

Flutter

The second introduction to Flutter is a cross-platform application development framework. When it comes to Flutter, there is something about Flutter. In 2018, I started to write an official account. The first article I read that broke 10W was “Hello, Flutter” published in Jane’s book. That year, Flutter came out of the sky, promising to change the momentum of mobile development. Because I did mobile terminal development for a period of time when I was an undergraduate, I was deeply attracted by it after reading its official documents. During this period, I also wrote some introductory articles, but it was not systematic. Although I am no longer working on mobile apps, I always keep an eye on the development of Flutter community. This year, I picked it up again because I had to work on my graduation project.

Flutter’s website says that Flutter is Google’s open source UI toolkit that helps developers efficiently build beautiful applications for multiple platforms, including mobile, Web, desktop and embedded platforms, using a code base. To put it simply, Flutter is Google’s new SDK for building cross-platform mobile apps. Write a code that runs on both Android and iOS, and, of course, now runs on the Web and desktop, but not as well as mobile.

Although there have been some cross-platform solutions before Flutter, such as ReactNative and Weex, there are still many people who like Flutter. I also answered the question on Zhihu about why some people like Flutter. – Answer from LYYYYY – Zhihu. Personally, I think the reasons are as follows:

  1. Big factory endorsement, Google has been promoting
  2. Dart is a low-cost language that can be learned quickly if you know Java
  3. Cross-platform. This is the most important thing. Flutter currently runs on Android, iOS, MacOS, Windows, Linux and many other platforms
  4. There are many beautiful components built into Flutter. There are also many excellent third-party components on Pub. dev that are easy to use
  5. Developed App performance is strong enough.

All in all, Flutter is a good choice for people/small teams who want to quickly build cross-platform apps (for graduation projects, startups, etc.).

Docker

The third thing I want to talk about is an operation tool — Docker. Speaking of Docker, many people are familiar with it. Docker is a very popular tool in recent years. Although I heard about it a few years ago, I did not use it on a daily basis until this year.

In fact, Docker was invented to solve one of the biggest problems in software development — environment configuration. Each user’s equipment is not consistent, and the environment is naturally varied. How do you make sure your code works elsewhere?

Users must ensure two things: setup of the operating system and installation of various libraries and components. Only if they are correct can the software run. To install a Python application, for example, the computer must have a Python engine, various dependencies, and possibly environment variables.

Is there a way to fundamentally solve the problem so that software can be installed with the environment? That is, when you install it, you copy exactly the original environment.

The virtual machine was one solution, but the solution was resource-intensive, cumbersome, and slow to start, so Linux developed another virtualization technology: the Linux container. ** The Linux container is not a complete operating system, but rather isolates processes. In other words, a protective layer is placed over the normal process. For the process inside the container, its access to various resources is virtual, thus achieving isolation from the underlying system. Simply put, containers are like lightweight virtual machines that provide a virtualized environment at a much lower cost.

Docker is a Linux container package, providing an easy-to-use container interface **. It is currently the most popular Linux container solution. 支那

This year I used Docker mainly to provide a one-off environment and build a microservice architecture. I used Docker-compose to integrate the middleware needed in the project, such as MySQL, Redis, MQ, etc.

I’ve also translated articles like “Create a private PostgreSQL database for Your development environment in Seconds” and “Migrate from monolithic to microservice Architecture in 5 Minutes” for nuggets.

Lambda

The fourth is neither a framework nor a tool, but a new feature introduced in Java8, Lambda. Speaking of Lambda expressions, we have to say functional programming.

Like OOP, functional programming is an idea, an idea. If object-oriented programming is the abstraction of data, functional programming is the abstraction of behavior.

Lambda is the embodiment of this idea of functional programming. Lambda expressions, also known as closures, can make code more compact by allowing functions to be passed as arguments to a method.

All this talk is too empty. Let me give you a simple example.

All this code does is add a listener event to a button that, when clicked, will print a “button Clicked” behavior.

button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            System.out.println("button clicked"); }});Copy the code

This code is easy to understand, but it also illustrates a problem. Before Java supported functional programming, the common way to pass a behavior was to pass an object, and anonymous inner classes were designed to facilitate passing code as data.

However, with the introduction of functional programming in Java8, we can abstract click events and pass them as parameters, as shown in the following example:

button.addActionListener(event -> System.out.println("button clicked"));
Copy the code

This approach is called a Lambda expression. The body of the Lambda expression syntax rule is divided into two parts, connected by a “->” right arrow in the middle, with the left representing the parameters and the right representing the function body.

Functional programming has been around for a long time, but I only learned it briefly before, and I really started to use it in daily life when I did my internship on Taobao in summer vacation. There were many Lambda in the project code (not excluding the possibility that the seniors showed off their skills). Although it seemed a little annoying and difficult to understand at first, after I got familiar with it, The streamlining of project code is also evident.

There are a lot of information about Lambda on the Internet. This is just a recommendation. Interested partners can search and learn from Lambda.

Proxyman

The next step is a piece of software. The first was Proxyman. Whether front-end development or back-end development, especially for crawler engineers, packet capture is a very important skill, and a good packet capture tool is crucial. Proxyman is a package capture tool I stumbled upon this year, and I fell in love with it after only using it once.

The reason for choosing it is simple, simple to use. Compared with Charles, it can be laid out at will, managed separately by multiple devices, and preview key information required on one screen. Moreover, the configuration of mobile terminal packet capture is much simpler than that of Charles. Above all, the level of appearance is high enough. Just as the so-called appearance level is justice, for a software, the same is true, if a software is not beautiful, it is certainly not a good software.

But it’s only available on the Mac, which is a shame.

iTerm2

Like Proxyman, iTerm2 is Mac exclusive. ITerm2 is arguably the preferred terminal tool for MacOS, because as a Coder, it’s not a good idea to always use a graphical interface. Although MacOS provides a terminal software by default, iTerm2 is far more powerful than that, and there are plenty of fancy configurations on the web, so I won’t go into details here.

This year, I used it to connect to remote servers, view logs, and so on. ITerm2 has helped me a lot. If you want to try command processing, iTerm2 is a good choice.

PPRows orcloc

They both do the same thing, they count lines of code, but one is a graphical interface and the other is a terminal command, depending on which one you prefer, but PPRows is only available on the Mac, which may affect your choice.

I personally prefer cloCS, after all, why use a mouse to do something you can do with a command?

Anyway, it’s time to figure out how much code I have.

uTools

With just one picture, I’m sure you’ll immediately know what uTools is.

UTools is a minimalist, plug-in, cross-platform modern desktop software. Create a handy collection of tools with a variety of plugins. When you get used to it, it can save you a lot of time and allow you to focus more on changing the world.

This is a quote from the uTools website, which is actually a tool developed by a few programmers for themselves, and of course for most people.

When reading English documents, if some words are not clear, direct shortcut key call translation; Suddenly want to calculate, direct shortcut key call calculator; Want to see color codes? Want to OCR? UTools can do both.

Compared to Alfred, uTools is much more localized, the logic is much simpler, and most importantly, it’s always been a shame that there isn’t a Spotlight app to match Alfred’s for non-MacOS users. UTools supports MacOS, Linux, and Windows. No matter what operating system you switch to, you can seamlessly experience the powerful functionality of uTools.

VSCode

Since this article is about the good thing you encounter in programming, it must be inseparable from the IDE. The reason WHY I didn’t introduce mainstream IDES such as IDEA and WebStorm is that I think they are too common for people to talk about.

But VSCode, it really surprised me this year. Previously with VSCode, I used it more as a text editor. This year, however, when I ran IDEA, AndroidStudio and WebStorm at the same time, my 16-gigabyte MacBook Pro was noticeably struggling, so I turned my attention to the “text editor”.

Its advantages are obvious. It has rich plug-ins and perfect language support, including Vue, React and Flutter. With the LeetCode plugin, you can also submit questions directly from the editor. After installing and configuring Java plug-ins, the experience of writing Java code is similar to IDEA. Not only is the memory footprint small, the file opening speed is extremely fast. And most importantly, look good. At first, many developers struggled with sublime Text and Atom, but today, the latter two still have a lot of weight.

As I said before, VSCode is more used as a “text editor”. This year I used Markdown to write my blog and official account, and the content was mostly used with Typora and VSCode. Not only that, but I recently used VSCode to unlock a new pose for writing Latex. The experience of writing a paper went up again.

Forget it. I’m going to use VSCode liver papers.

conclusion

These are just a few of the cool things I encountered while programming in 2020. 2020 has come to the end of the year, DO you have any new plans for the New Year? Take a notebook and write down all the things you want to do this year. Finally, I wish you all the best in the Year of the Ox!