

I personally often use switch blocks when using the Factory pattern etc.
To be or not to be switch how to#
However, when and how to use either is somewhat your decision. (The Strategy pattern was also mentionned.) However, in your case, you might also look into the Command pattern.īasically, in OOP, you'll try to use other solutions than relying on switch blocks, which use a procedural programming paradigm. However, usually, you would use switch statements when implementing design patterns one example would be to use a Chain of responsibility pattern to handle the commands given any command "id" or "value". Or a List if your commands are numeric and have no gaps.

One solution would be to use a Map where the keys are the commands, and the values Command objects with an execute() method.
To be or not to be switch free#
Please feel free to GET IN TOUCH if you have any questions. You can SUBSCRIBE for future updates. And please share with others in your network who might benefit.IMO switch statements are not bad, but should be avoided if possible. SIGN UP NOW for this limited FREE offer.Ĭome along to my 'Be Your Own Boss' FREE LIVE Webinar on August 15. In this interactive webinar I'll share my top tips for success in setting up your own business with specific time and attention to your burning questions. In this course, the Consulting Business Compass Course, I share with you the practical learnings, lessons, tools and resources that will help you navigate your way to being your own boss by setting up and succeeding in your own consulting business. I’ve packaged my learnings and insights from setting up my own consulting business into an online course. Go HERE to get your FREE complimentary copy. The SET YOUR COMPASS WORKBOOK can help you review where you are at with your goals and aspirations and set, refine, or reset your goals for 2022.23. With the new financial year upon us, it may well be timely to review your 2021/2022 year and set your goals for the next year. I know this isn’t the path for everyone HOWEVER if you have these dreams and desires maybe it’s time to put your energies into making them a reality. My motivation to take this leap was driven by a deep desire to: And I haven’t looked back – not for one day. This year marks my 22nd year in my consulting business. To see them succeed and flourish has been a rewarding experience. I have also helped and coached (both formally and informally) many to make the leap from employee to business owner or self-employed. Equally common is the response that 'I can’t/couldn’t do it'. The yearning to be one’s own boss is a common aspiration for many people I deal with – clients, friends, family. There were numerous reasons that followed the 'because'… my kids are still at school so I still need a secure income.I can’t afford to jeopardise my super…what happens if it doesn’t work and I have trouble finding another job…. "I don’t particularly enjoy who I’m working for (and I can’t see that changing anytime soon) and I’m finding I am becoming increasingly frustrated with the system I’m working in."


When we delved deeper into her ‘dreams’ – her dream was to escape the corporate world and be her own boss. I was working through goals and aspirations with one of my executive coaching clients recently.
