Refactoring: switch vs if-else vs enum vs HashMap [Command Pattern]

Published: 28 October 2020
on channel: MJC
6,998
310

The developer Nastya Borisenko will talk about a typical problem of a large number of if-else. Consider a popular way to solve this problem in java programming and tell you why switch is not a panacea.

Timecodes:
00:00 - In this episode
00:13 - Intro
00:19 - Let's talk about code quality!
01:36 - Funny (no) life story
01:51 - if-else, switch-case
02:13 - Example using if-else
04:20 - Refactoring using switch-case
04:59 - What is the problem with switch-case?
06:16 - What can replace switch?
06:30 - Refactoring using enum
11:50 - Lazy initialization with enum
13:28 - Refactoring with Map
14:15 - Why suggested options are better than switch
15:02 - Subscribe and like

Git Link: https://github.com/NastassiBor/mjc/tr...
________
Subscribe to our social networks:
Instagram:   / mjc.talks  
MJC Telegram Chat: https://t.me/mjcby
Community page: https://mjc.by


Watch video Refactoring: switch vs if-else vs enum vs HashMap [Command Pattern] online without registration, duration hours minute second in high quality. This video was added by user MJC 28 October 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 6,998 once and liked it 310 people.