Thursday, October 3, 2024

Alternatives to becoming a Full Stack Developer

Starting out
When you're starting out your career as a software developer, you'll typically get a first role as either a backend or frontend dev, and after a couple of years, gain some experience on the other side to become a full stack developer.

Company specific lock in
Since every organisation has its own tech stack, a full stack developer in Company A will have a different set of skills than one in Company B. Those additional skills you learn are still useful to boost your knowledge - it can include: specific cloud services, CI/CD, containerization, DevOps processes, a domain specific library or framework, and the company's SDLC process. 

At this point many developers stay committed to their company's tech stack and remain working as a full stack developer for several more years. My advice - don't just coast as a full stack developer, limiting yourself to web apps. Branch out as soon as you get the chance, by getting experience with any of these. Do it in your own time if there is no opportunity at work.

  • Native mobile app development (Swift or Kotlin)
  • Cross platform mobile app development (Flutter or React Native)
  • Desktop app development
  • A newer backend programming language (Golang, Rust or Elixir)
  • AI & ML
  • IoT (Arduino or Raspberry Pi)

Become a generalist
Your aim is to become a "generalist" - someone who has deep knowledge in two or more areas and maintains a broad knowledge across many platforms, languages and frameworks.

After becoming a generalist, you'll be able to switch up your job roles, stretching your capabilities a bit each time you move. You'll find that you can apply for a larger set of roles, increasing the possibility to land your dream job. 

Career progression
Your varied knowledge will make it easier to apply your skills in new and unfamiliar areas, building up after some years to become a senior developer. Once there, its possible to remain at the senior level for an extended period - as long as you still enjoy it and are still learning, why not.

Eventually you might try for a tech team lead or software architect role. Software architects often started out as generalist developers who gained enough varied experience to be able to apply their software design skills into any domain. Tech leads can have a similar background, but they maintain more of a hands on development focus as part of their role, getting involved especially with creating proof of concepts. 

More reading
Generalist vs Specialist - the difference
Bill Gates on the book "Range: Why Generalists Triumph in a Specialized World", by David Epstein 
"The Polymath: Unlocking the Power of Human Versatility", by Waqas Ahmed
"Polymath: Master Multiple Disciplines", by Peter Hollins



Thanks to reddit user -NewYork- for this meme

Sunday, September 29, 2024

Which .NET ORM - Dapper or Entity Framework?

Within the .NET ecosystem, two ORMs dominate, the lightweight Dapper (open source) and the fully featured Entity Framework (EF) by Microsoft. 

Depending on your project's size and requirements, either of these should work well for you, but there are definitely some known cases where each is a better fit. That's what we're discussing in this post.

When to use Dapper?

  • Small to medium size projects. It has low overhead in terms of setup and configuration.
  • The database tables are in place already and you're calling existing stored procedures. This is known as a data first approach.
  • You prefer to hand code the SQL for speed, optimization or fine tuning.

When to use Entity Framework?

  • Its a large and/or enterprise type project.
  • The database hasn't been created yet and you'd like to use a code first approach. The framework will create the database for you after you code the data models.
  • You want the ORM to handle transactions for you in the background.
  • You need to use the power of C# LINQ (Language Integrated Query), whereby SQL joins and other queries are generated for you based on your C# code.

Other important factors

  • Is your project likely to change frameworks, or need to be adapted to other databases? If yes I'd favour Dapper, because there's just less to migrate and configure. Dapper tries to not get in the way. There are no  additional abstractions and class models that happens with EF.
  • Are you using .NET Core? Its probably a controversial opinion but I feel that .NET Core as a framework is still quite unstable compared to the original .NET Framework. So when a new version comes out, there's normally breaking changes within EF Core. For that reason I'd also favour Dapper over EF for .NET Core projects.

What's not a factor?

  • Speed and performance. There's no longer any significant performance difference between Dapper and EF. Issues with performance are more likely to be something else that's not being done correctly at the SQL level, such as a lack of indexing, or an incorrect query.
  • The origin of the framework. The first release EF for .NET which came out in the 2000s had terrible performance. Since that time, all the performance issues have been fixed.

Sunday, May 15, 2022

What the LUNA cryptocurrency has in common with a Thanksgiving Turkey and the LTCM hedge fund

A classic black swan event has just happened to the LUNA cryptocurrency.

A black swan event is characterised by a spectacular run up in price, followed by the price falling off a cliff to near zero.

It famously happened to a hedge fund named LTCM (Long Term Capital Management) back in 1998. The resulting loss temporarily destabilised Wall Street, requiring a bail out to be organised by the US Federal Reserve.

For LUNA, as with LTCM, a group of the smartest people in the room had banded together based on the unstoppable winning formula of:

(new technology + maths + programmers + marketing + chutzpah) = profit

Then claimed they'd solved a previously hard and intractable problem, and that everyone who doesn't believe them can just STFU, or in the case of Do Kwon (the founder of LUNA), "enjoy being poor". Oh the karma.

The risk with crytocurrency in particular is that if there's a bug in the algorithm or protocol, the result can be both an immediate financial loss, and a catastrophic loss of confidence in the currency. The bug can go unnoticed for months or years, before someone finds it and then patiently sets things up to exploit it for maximum profit.




Follow @dodgy_coder on Twitter

More reading:
How Terra's UST and LUNA Imploded (Decrypt)
Roundup of theories on the LUNA crash (Fortune)
'Evil genius' may have caused Terra and Luna to crash in a 'death spiral' (ABC Australia)
Long-Term Capital Management Hedge Fund Crisis (The Balance)
The Black Swan by Nassim Nicholas Taleb - Summary and Analysis (Get Story Shots)
The Black Swan Theory (Wikipedia)

 

Monday, March 21, 2022

Cheaper alternatives to Mind Lab Pro, Alpha Brain and other Nootropics in Australia

Nootropics are a popular new type of dietary supplement that claim to enhance brain function in a number of ways including better memory, sharper thinking, alertness, improved verbal ability, more clarity and the elimination of 'brain fog'.

I started looking into some options available that deliver to Australia and came across this brand called Mind Lab Pro. Their tablets contain some of the same ingredients to standard vitamin supplier Swisse's Ultiboost Memory+Focus or even a Swisse's men or women's multivitamin for ages 50+. The reason its in the 50+ and not their standard multivitamin product is that the 50+ age group are considered more in need of brain enhancing ingredients due to the age related decline.
 
With the 50% discount offered by a popular chemist retail chain, the Swisse Ultiboost Memory+Focus tablets come down to AUD 32c each.. (AUD $16 for 50 tablets). Compare this to Mind Lab Pro at AUD $1.11 per tablet, working out to a 247% premium in price! And remember, you only get this price with Mind Lab Pro if you buy 4 bottles in your first order.

Another option with more herbal extracts than Swisse Memory+Focus, but with no B vitamins, is Oriental Botanicals Memory. This product comes in bottles of 60 tablets and after a standard chemist discount costs AUD $37, or 62c each tablet - about double the Swisse option, but still significantly cheaper than Mind Lab Pro.
 
Many nootropic suppliers exploit a psychological effect known as the Sunk Cost Fallacy. Where the more you have invested in something (the sunk cost - effort, time or money) the less likely you are to stop doing it, even when there are no further benefits to you continuing to do it.

By supplying 4 months to you in your first order, the Nootropic company knows you’ll become invested in it and will not want to admit to yourself at the end of 4 months that you're not seeing the promised benefits.

Its likely many nootropic products are overhyped and overpriced. Famous US blogger Joe Rogan actually requested one popular US supplements brand (Onnit) to prepare a new product, called Alpha Brain. Check the list of all the other supplements Joe Rogan takes by the way - its pretty much a list of every supplement known to man, I'm surprised he has room left to eat any actual food!
 
Final note, Alpha Brain here in Australia costs AUD$119.90 for 90 tablets, or $1.33 each tablet, so about 22c more per tablet than Mind Lab Pro.

Follow @dodgy_coder on Twitter





Saturday, October 23, 2021

Review: InMotion S1 Electric Scooter (AUD$1299)

The InMotion S1 electric scooter. At the front is my wife's scooter, the VSETT 8.

Electric kickscooters are really popular right now. Their sweet spot in terms of usefulness is probably for people living in urban and inner city areas, or in areas which have good bicycle paths. I live in an inner city suburb of Perth, Western Australia, and work near the Swan river - my reason for buying one was to have some fun while commuting to work. My commute on the scooter is about 14km (9 miles) and takes me 40 minutes.

Four weeks ago I bought the InMotion S1 scooter for AUD$1299 (~ USD$970). In my review here I compare the manufacturers promotional material and claimed specifications to my real life experience of the scooter.

Scooter model history
The S1 is InMotion's latest model scooter, launching in Australia in September 2021. It has been adapted from the InMotion L9 model, which was crowdfunded on IndieGogo successfully back in May 2020. The S1 seems to be targeted at markets outside of the US, such as Canada, Australia and Singapore. The L9 and S1 look very similar, they share the same controls and share the same smartphone application.

Smartphone app
First thing to do is to pair the smartphone app with the scooter. This was easy and I didn't run up against any problems. I used the iPhone app, and there's an Android app available too. There was only one tricky thing I found with the app - changing the distance units from the default (miles) to kilometres. To do this, you need to first change it under the vehicle settings - this will ensure the speedo on the scooter reads out in km/hr instead of miles/hr. But in the app itself, it still displays the battery's remaining range in miles. To get this into km too you need to press on the "ME" link at the bottom, then settings, then "metric/imperial" units.

Speed limiter
The speed of the S1 is by default limited to 25 km/h (15 miles/h), but its easy to go into the app and turn this limit off (under vehicle settings). Doing this lets your scooter achieve the max speed of 30 km/h (18 miles/h). Unlike other scooters, this is purely a software setting and doesn't require any wires to be disconnected or anything to remove the speed limiter.

Braking
The S1 has an automatic electric brake on the back wheel, which kicks in automatically if you are going downhill and picking up speed rapidly, or have exceeded 30 km/h. The maximum speed I've achieved on the scooter is around 30.9 km/h while going downhill. The automatic brake is kind of jerky and not really smooth - it feels weird the first time you experience it. There's a toggle setting in the app related to the automatic brake, so I tried turning it both on and off but couldn't feel any difference. There is only one manual brake lever - for your left hand - this is hooked up to the front wheel drum brake. Drum brakes are actually preferable to disk brakes on a scooter because it means no parts are exposed, and so there are less mechanical parts to maintain.

Control panel & display
One of the best things about this scooter is the easy to use control panel and the large display in the middle of the handlebars. There's only one button, and it can perform the functions of power on/off, headlights on/off and to toggle through the three riding modes (Eco, Drive, Sport). Long press is power on/off. Single click is headlights on/off and double click is to toggle the riding mode. Compared to other scooters (like the VSETT range), these controls are intuitive and easy to remember. The throttle is thumb based - you push downward with the thumb of your right hand. Compared to the VSETT scooter throttle which uses your forefinger in a trigger action, I find it to be more natural and better suited to long commutes.

Bling LED lighting and auto turn signals
The scooter has a strip of roadfacing LED lights down each side of the deck, these stay blue while riding and automatically flash red when you are turning to the left or right. This is a great idea, because when riding a scooter its not recommended to take one hand off the handlebars to indicate your turn manually (as per a bicycle) due to instability. The only downside to the auto turn lights is that they don't activate until you either tilt the scooter or turn the handlebars in the direction you are going, so in other words anyone behind you only sees the indication when you are actually turning. Other lights on the scooter are the dual headlights and rear light / brake light. The headlights are positioned at handlebar height, making them extremely visible at night to oncoming traffic. With the LED lights, the scooter really turns heads at nighttime.

Riding modes - Eco, Drive, Sport
The Eco mode is a beginner mode - you won't go faster than 12 km/h (7.5 miles/h) and the acceleration is really soft. The Drive mode is supposed to be a standard commute mode, which limits your top speed to about 20 km/h (12.5 miles/h) and also limits the acceleration responsiveness to about 80% of maximum. Sport mode means no limits, on a full charge you'll get up to the top speed of 30km/h (18 miles/h) with the fastest possible acceleration. I keep it on Sport mode all the time - once you get used to the speed and the handling of the scooter I think most riders will do the same. These modes of course will impact on the range you'll get out of your battery charge, Eco will use the least amount of battery and Sport will use the most.

Range
In the promotional material the claimed range on a full charge is 95 km (59 miles). But in the manual it lets you know that this was achieved on level ground, in Eco riding mode, with a 65 kg weight rider and zero wind. So in other words, nowhere near real world conditions. In real world riding - in Sport mode the entire time, hills, wind, myself being 80kg, I found that the range ended up being 55-60 km (34-37 miles). But this is still a really good range - it easily handles my 28km round trip daily commute, and leaves some spare for other short journeys nearby to work or home.

Score card

Good points
+ Large display, intuitive controls, comfortable throttle
+ The app tells you the estimated distance left on the battery charge
+ Cool underdeck LED lights, auto-turn signals, dual headlights
+ Large non-slip silicon deck
+ Big real world range
+ Front and back suspension

Bad points
- Its too big to take onto public transport like a bus or train
- Height of the handlebars is not adjustable and is high compared to other scooters
- A couple of poor quality fixtures like the bell and the charging port dust covers
- Jerky automatic electric brake kicks in when going downhill

Conclusion
A great long range commuter scooter with decent performance, cool LED lighting, a solid feel, easy to use controls and a large display. If you don't need to take it on public transport, then this scooter will be perfect for your medium to long distance commute, given its large 55km (34 miles) real world range.

Where to buy?
As of writing, this model scooter is sold out around most of Australia. Due to high demand and shipping delays I recommend contacting the shop where you intend to buy first to confirm when stock will arrive before paying anything upfront for a scooter.

Follow @dodgy_coder on Twitter



Saturday, October 17, 2020

Does Xamarin owe its existence to Unity & Apple?


Yes, Xamarin owes its existence to two other bits of technology that were huge around 2008 - the Unity Game Engine and the iPhone. The reason is that a confluence of events around 2008 provided the push to get the Mono project into mobile app development. This resulted in MonoTouch (for iOS) and Mono for Android, which eventually became Xamarin as we know it today.

The Mono project was founded in 2001 as a free open source implementation of Microsoft's .NET framework on Linux. But Mono had struggled since its inception to find its reason for being. According to Mono's founder, Miguel De Icaza, the hardcore free open source community never fully got behind Mono. The FOSS community feared that Microsoft would eventually cause problems for Mono, due to Microsoft being the creator of .NET. 

Outside of the Linux world however were other more pragmatic people from the MacOSX world who had no problem with Mono. One of these people was Joachim Ante, from Unity. Around 2005 the Unity game engine was just starting out and had a performance problem - their original scripting language of Python was far too slow - they needed something that was an order of magnitude faster. So Unity decided to replace the Python scripting with Mono/C# and immediately got all the performance they needed. This was the early days when the Unity Game Engine ran on MacOSX only. Mono filled the need of being a free open source JIT compiler with the modern language of C#.

Fast forward to 2008 when the iPhone App Store launched; Unity quickly set their sights on being able to compile games for the iPhone. Unity wanted to use Mono, but the additional requirement was that it had to be statically compiled for iOS, because Apple had banned the use of JIT (Just In Time) compilers in iOS Apps.

Unity comes back to us and says “Hey, we have this product on iOS, we need .NET to be statically compiled. Can you do that?” We were like, “Oh, that’s kind of impossible. Well, let’s think about it.”

One of our guys, Zoltán Varga - they went and made a static compiler for .NET, and it was amazing. We gave it to Unity. At this point, Unity is probably four or five employees.
    
They were working at somebody’s garage. And they shipped their product for iOS, built games for iOS using this thing, this 3D tech. They were the kings of this space.
    
- Miguel De Icaza (Xamarin)

Within a year of the iPhone App Store launch, Unity went from 4-5 employees to 80 employees. The iPhone and the App Store had launched Unity's massive growth, and along with this the Mono project had finally found its reason for being - mobile apps. The Mono developers realised there was interest in using .NET for mobile apps - so using the same tech given to Unity, they built their own product - MonoTouch, which allowed developers build native iOS apps using C#. Soon afterward, Mono turned its attention to Android and created Mono for Android.

Mobile app development was new and there were many developers who wanted to get into mobile apps but didn't really want to have to learn Objective-C and Java. So Mono now had a C# based cross platform app development platform with truly native performance. This was the killer combination that ensured Mono would take off in popularity.

The developers behind Mono founded the Xamarin company in 2011, MonoTouch became Xamarin.iOS and Mono for Android became Xamarin.Android. Xamarin was acquired by Microsoft in February 2016 and became a subsidiary of Microsoft, fully focused on the development of Xamarin's open source projects.

Inspiration for this article:

The History of GNOME, Mono, and Xamarin
https://changelog.com/podcast/275


Follow @dodgy_coder on Twitter


Sunday, May 24, 2020

Breakout: a Circuit Breaker implementation in C#

A circuit breaker can help you improve the stability of your application by protecting calls to third party services; e.g. a web service, a network resource, a database, or any other component which can intermittently fail.

Its a fundamental pattern for protecting your system from all manner of integration point problems. It is a way to fail fast while there is a known problem with an integration point.

The circuit breaker pattern was first described in detail by Michael Nygard in the Stability Patterns chapter of his book "Release It!" Design and Deploy Production-Ready Software.

Breakout is a C# .NET implementation of Michael Nygard's Circuit Breaker state machine, using the Gang of Four's STATE design pattern. I've created a NuGet package for it here.

This implementation is thread safe, lightweight and easily adapted into your existing codebase. Unlike other circuit breaker implementations, it leaves the responsibility for calling the third party service with your client code. Your code only needs to inform the circuit breaker of the success or failure of every call to the third party service, via OperationSucceeded() and OperationFailed(). Check the README on github for example usage.


Breakout - State Machine Diagram

State Machine Explanation


The state machine starts in the CLOSED state. While in the CLOSED state, calls flow through as normal to the third party service. If the operation succeeds, the failure count is reset. If the operation fails, the failure count is incremented. When the failure count threshold is reached, the trip breaker action is performed, which transitions the state to OPEN.

While in the OPEN state, no calls flow through to the third party service. The caller just returns immediately, without performing the service call. After the open timeout has passed, the attempt reset action is performed, which transitions the state to HALF OPEN.

While in the HALF OPEN state, only one call is let through to the third party service. If the operation succeeds, we reset the circuit breaker which transitions the state to CLOSED. If the operation fails, the trip breaker action is performed, which transitions the state to OPEN.

UML Design


The design uses the Gang of Four's STATE design pattern.

Breakout - UML diagram

Follow @dodgy_coder on Twitter