[Laravel/Lumen] A story about "efficiency" told by a novice & veteran engineer [Beyond study session #30]

Hello!
This is Fukui from the System Development Department!

This may seem sudden, but I think that for developers, writing programs that are "faster, less burdensome, and easier to read" is a mission and an important theme.
So, we thought, "Let's learn all about how to develop efficiently!" With the cooperation of Extrance Co., Ltd., we narrowed the topic down to the "Laravel, Lumen" frameworks, which are often used in our PHP development, and jointly held a study session!

 

A talk about "efficiency" from novice and veteran engineers

This time, the main theme was "Efficiency as told by novice and veteran engineers," and we had three distinguished speakers speak about it!

1. " Let's use Eloquent to make DB access more efficient! " Masari Nishihara, Beyond Co., Ltd.
2. " Best practices that can only be learned by making full use of the collection function " Yoichi Bandai, Beyond Co., Ltd.
3. " How to create an in-house application using Lumen " Yukichi Nanko, Extrance Co., Ltd.

*Videos of each speaker's presentation can be viewed on YouTube via the title link

Session 1: "Let's use Eloquent to make DB access more efficient!"

The event began with a speech by Nishihara from our company Beyond

Like Nishihara, I've been an engineer for six months now, and the introductory part, "It's not enough if it just works!!" really resonated with me...!
After an overview of Laravel and MVC, focusing on load reduction and processing speed, we moved on to the topic of efficient model handling.
This time, we used a clear demonstration to explain how to efficiently retrieve related records using the "with function" in Eloquent.

After an explanation of the difference in the number of database accesses and the executed queries, a comparative test was conducted on the processing speed and memory usage compared to when the with function was not used, and the superiority of the with function was immediately apparent

I often use the with function in my work, and this has made me realize once again how convenient it is...!

In the second half, there was an attempt to use the chunk and cursor functions to find ways to reduce memory usage other than using the with function, which was very interesting!

Click here to watch the presentation video:
"Let's use Eloquent to make DB access more efficient!"

Session 2: "Best practices that can only be learned by making full use of the collection function"

The second session will be attended by Bandai from our company Beyond

The opening words "I've been using PHP for 15 years now" carry a lot of weight...!

This time, we were given an overview of Collections, their advantages and disadvantages, and how to use them.
I personally use Collections when manipulating arrays, but I still have a lot to learn, so there was a lot of useful information and points I would like to refer to.

In the first half of the lecture, the difference between Collection and foreach was explained using the example of performing multiple operations on an array, and the content was very easy to understand and satisfying

In addition, under the theme of "Collections can be used in tests," he introduced examples of using Collection methods in Unit tests, which I personally thought was something I should remember!

There were also many other questions, such as using Collection to find "unique combinations using three numbers between 1 and 10" and "a student's test score," so I hope you will take a look at the explanations in the video!

Click here to watch the presentation video:
"Best practices learned from using the collection function to the fullest"

Session 3: "How we created an in-house application using Lumen"

The third and final session was presented by Nankou from Extrance, Inc.
He spoke on the topic of "Creating an in-house application using Lumen," but the first thing that really caught my eye was Nankou's love for Gopher! (For more details, please watch the video of his presentation!)

Now, regarding the content of his presentation, Mr. Nankou first explained what motivated him to start using Lumen, gave an overview of Lumen, and then introduced us to the ``approval request email distribution app'' he actually created

In the first half of the talk, Mr. Nankou talked about himself before and after using Lumen, and what was impressive was how convenient the framework was!

After that, he will explain how to write Lumen's routing, controller (and model), and validation processes using code examples, and in the second half he will move on to the topic of "The differences between Lumen and Laravel."

He gave a more detailed explanation, including artisan commands that cannot be used in Lumen, loading Facade and Eloquent, and differences in how to write processes to obtain environment variables

At the end, he also summarises the advantages and disadvantages of Lumen, the framework's usability and features, and the differences with Laravel, so you can watch the presentation video for more specific details!

Click here to watch the presentation video:
"How we created an internal application using Lumen"

summary

What did you think?
Throughout the first three sessions, we received a wide range of easy-to-understand explanations on efficient usage and writing methods when using Laravel (Lumen), useful functions, the differences between Laravel and Lumen, and more. I'm sure that everyone reading this article will find the content useful! (Personally, I found this study session extremely helpful...!)

Beyond will continue to hold study sessions on infrastructure and development, so please feel free to join our next session via connpass '' or `` Doorkeeper

*If you register as a member of each community, you will be able to check immediately when study sessions are being held

・Beyond Study Group | connpass

・Beyond Study Group | Doorkeeper

lastly

I have opened the system development service site "SEKARAKU Lab" to which I belong.
Beyond is a one-stop service for everything from server design and construction to operation, so if you have any trouble with server-side development, please feel free to contact us.
SEKARAKU Lab: [https://sekarakulab.beyondjapan.com/](https://sekarakulab.beyondjapan.com/)

Thank you for reading to the end!

If you found this article helpful , please give it a like!
0
Loading...
0 votes, average: 0.00 / 10
1,849
X facebook Hatena Bookmark pocket

The person who wrote this article

About the author

Hiroto Fukui

Joined Beyond in June 2020.
He works in the System Development Department (Yokohama office). His work focuses on PHP, developing game APIs and web systems, and developing Shopify private apps.
He likes music in general, mainly Western music, and plays the guitar as a hobby. His favorite TV shows are "Detective! Night Scoop" and "Infestation! Ad Street Heaven."