Speaker

Gaurav Suryawanshi

Gaurav Suryawanshi

Software Engineer 3 - MoneyForward Japan

Actions

I am currently working at MoneyForward Japan as a Software Engineer 3 since April 2022, developing proficiency in Golang and React-Typescript. Before that, I worked as a Software Engineer for one year in Microsoft R&D in Hyderabad, India. I completed my university education at IIT Kharagpur in 2021, majoring in Mathematics & Computing.

Revolutionising Inheritance with Generics: A Fresh Approach in Go

With the introduction of Generics in Golang 1.18, there's hope for a more user-friendly language. Yet, due to its newness, there's a lack of support and a steep learning curve for using generics. This proposal aims not only to tackle these issues but also to redefine how inheritance works in software development using this advanced generics approach.

Current approaches in golang for achieving inheritance are highly focused on using interface based approaches in which all siblings have to implement the said interface. Cons of this approach restrict the freedom of using common fields in such sibling structs and require switch type to obtain the fields.

Another approach one might think is to utilise the golang embeddings and return the embedding struct as return response of interface implemented. However it does offer crippled inheritance because Go's embedded struct does not provide the same flexibility as the actual inheritance. One such example is this: driver.Drive(tesla.Car.NumberOfWheels). Even though tesla is a vehicle, in Go, you need to get to the actual base class in order to use it as an argument. Declaration also requires the parent struct to be mentioned which is a problem in itself.

To overcome the above cons, we propose a new method of utilising golang generics which not only provides flexibility of interface based approach but also prevents the problems addressed in golang embeddings. This method has been utilised by the MyPage team in MoneyForward to overcome inheritance problems in golang.

This proposal is crucial in the Golang community as the exploration of Golang generics is still relatively unexplored, despite the abundance of information online. This talk aims to fill that gap by offering essential insights for a practical understanding, bridging the existing resource gaps. Attendees can expect to not only deepen their understanding of how generics work but also to gain practical tools for seamlessly integrating generics into their daily programming tasks.

Gaurav Suryawanshi

Software Engineer 3 - MoneyForward Japan

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top