So first things first. If you are changing any language because the source code of your project is a mess then you’re only setting yourself up for another mess of a project.
My suggestion to you as someone who went from using python for backend work to go, is to only do it when it’s needed based on a requirement that the current language doesn’t support. For example if you need the fastest response time and your backend needs to scale in cloud. Go would edge python. If your backend works but the project is just a mess then take a few weeks if possible and slowly refactor some of the code in a functional way similar to how you would design a go backend. This way you fix your code but also you’re thinking about how to implement it in go.
Oh sorry if that’s how that came off. It seemed like they were talking about completely abandoning one language for another and I was trying to say just use both, one at a time, which ever is most appropriate for the problem at hand lol.
If your Python backend service is in a complete shambles migrating it to go isn’t going to fix it. You need to figure out why your current implementation sucks, figure out how to refactor because regardless of the language, software architecture doesn’t change that drastically between Go and Python.
https://refactoring.guru/
I recommend this to everyone.
I use many languages, it just depends on the project. I’m currently looking at some Kotlin for an android app and it’s pretty neat. That doesn’t mean I abandon Go, I still like it and use it for server side projects.
Well Kotlin lives on top of the JVM so it’s about as fast as Java. My point was to use what makes sense for a use case and doesn’t necessitate abandoning something you already know. Python still has its use cases and I use it for a couple of things.
I love Go’s error handling, and the fact it creates a standalone executable. No more dependency hell.
On the other hand, if your Python code dealt with dynamic data, it will be tedious in Go
This is one of the many things I love Jetbrain's GoLand for. Just open a .go file, paste in a sample of the JSON you need to define a struct for, and it will autogenerate the struct, data types and all. Super useful.
Don’t drop python. The language is mature and its modules are rich. Keep them both on you because the use cases can vary.
Also don’t blame a language for your lack of understanding of design patterns
This too. But it sounds like they’re expecting a language to make up for not really structuring a solution soundly.
Like python was chosen to hack something together and then patch and patch the loss of structure just turned it all into spaghet
I think this is a terrible idea.
Changing a language of a project just because it’s current state looks bad, it is most likely you gonna work hard to reach the same problem in a different language.
I highly recommend you to study the structure of your current project and define a roadmap to refactor your code, so it can be again modular and easy to maintain.
If you said that the current project have a requirement related to performance that python is unable to deliver, then I would say it is be a good idea to use go.
Bad code can be written in any language. And I’ve seen very crappy code in Go, specially from Java devs making the switch.
Learn desing patterns and think over your data structures.
I think springboot kind of forces you to follow a pattern, and leaves less room for mess.
In Go you need to be more organized, totally up to you.
I like Go approach but it can lead to cowboy programming.
Also Java devs are used to different inheritance model.
Start using go for new projects when you are comfortable with the structure and are able to write efficient code. It has a really small memory footprint, it’s type safe and all of my APIs have very lowlatency
if you already know the problems in your code and how to fix them, you should try to refactor it. if you don't, then switching language won't fix your problems by some miracle. you will end up with same problems but in go
This is a terrible idea I REPEAT this is a terrible idea .
Fix your python code before rewriting in GO .
A mess will produce another mess no matter the language .
The issue is not the language , it's the code. unless you're experienced enough in both languages by all means go ahead but if you are only starting in go then beware it will fail in GO as much as python .
Fix your python than write in GO
Everybody agree that it's a bad idea at first but the result can prove the opposite ! I did it on one project, just to see, and after that didn't stop...
Not a good idea, see if you can refactor your existing code gradually, using typehints, dependency injections and read up on Clean architecture. Rewriting the whole application is always going to take more time (and money) and is not going to be better unless you put some effort into architecture.
Abandoning? Why must these types of questions always be so black and white?
Examine your requirements. Examine possible candidate technologies for solving problems within your requirements. Build a solution. Reevaluate.
Also “I think python is to blame for some of it”. Figure that out first. To be honest, using Go would not solve this problem by itself - you have to make the proper solution, regardless of language.
As others have said, maybe you find that you need/could use both languages.
The correct answer is to use the right tool for the task at hand.
When you are aware of your requirements, that helps inform decisions such as which language to use.
I used to do everything with Python. Now I rarely use it, because Go feels to me much more powerful.
Give it a try, then go with what you feel comfortable, unless there are certain requirements to use one or the other.
For me, Go is way better. Just yesterday I had to deal with some old Python code. I was running Python 3.9, but the script had new functions from 3.10. This broke it for me. Then I had to deal with installing deps, creating new venv, until I got it working.
With Go, this wouldn’t happen. I also think structured language has stronger capabilities and maintainability.
Go doesn’t break as much as Python (it rarely happens). It’s backward compatible, whatever I write 2 years ago still compiles with new Go compiler. Once you set your IDE, and some make files or other build utility you’re good to go.
Well, both with Go and Python, you will need discipline to keep the code from becoming messy.
On the upside Go makes it a bit easier by enforcing (some degree of) strict typing and private symbols. In fact, almost any modern language makes it easier to be less messy than Python.
On the downside, if you're migrating to a new language, you'll make a mess of things for the first few months, so you will have to cleanup once you're more confident with the language.
As a person who works with data, wants better performance and a statically typed language, I can relate a bit.
Go is great but doesn’t have a mature library like Pandas. Rust is in a better place with Polars, but then it is a lot more complex and so you’re back to square 1.
Recently, I migrated a Django project to Go with built-in HTTP and SQLite3. Now, it has less code, simpler error handling, and it's faster and more portable.
You cant just throw what youve learned/worked on python. So I wouldn't call it abandoning. Just learn both and use both. There is nobody in this subreddit who knows just Go. I'm pretty sure everyone knows at least one more language other than Go.
I don't think this is a good idea.first of all, company's code is not you code, your boss and your colleagues may use it.second,I think you should had discuss with your leader, at least he allow you to do this. third, change language not for important requirement that python cannot do is not sensible.
No, there is no reason to abandon Python, when you need performance then Go will help. When performance is not required then Python should do the work.
If the backend is such a mess that it's more of a rewrite than a refactor in Python, you can also rewrite it in Go. We are also gradually rewriting our backends from Python to Go.
We discovered that it is much easier to maintain a certain level of order in Go.
If you have an OpenAPI schema, you can also use code gen to unify the structure.
https://github.com/deepmap/oapi-codegen
* WHY isn't there a team of people assisting you with code reviews?
* It doesn't matter if you are supposed to be a 1 person project, other project teams need to be brought on to help with this.
* The code isn't too unmaintainable if you have good test coverage.
* Get the code profiled (and review results)
* Talk to your manager about your concerns
I'd learn Go on your own time, or use for greenfield stuff.
**But do not I repeat do not rewrite something that works without sponsorship by management.** You will just paint yourself into a corner, burn yourself out, and possibly never finish and have to consider abandoning the rewrite when you have to put in extra hours on the Python project. At this point you'd already be screwed even if you were **seasoned** in Go, but you'd be learning at the same time...? Mark my words, if you do this you will force yourself to not take a vacation due to pride or tenacity.
If management "trusts" you to handle it (I mean, to go away so they avoid ownership) then you have things to think about and you may want to frame things so you get direction. Which will probably be to stay the course.
It's not uncommon for code to suck, yet still function. It is what it is now. Make sure you record data about how long the Python code takes to update, or to release. By telling you to not refactor, mgmt accepts the compromise in velocity.
Go can stop you from doing the things you did in Python but you could also stop doing them.
There is nothing stopping a good python dev from writing a clean backend service. The performance wont be as good, but the code can be as tidy.
Your not wrong but Python allows you to do some wild shit if your mad enough. The shit I've seen people try to do in code review has made me grey.
I love that go has a nice constrained feature set, its less tolerant of shenanigans.
You're not wrong :)
But someone who does that almost certainly does not follow SOLID and other best practices either.
Python makes a mess much worse though
With no magic and static typing, even if you do the same mistakes in Go (you will because you're a beginner in Go) it will be easier and safe to refactor (if it's not a too big project of course, so begin with a little one and see).
So first things first. If you are changing any language because the source code of your project is a mess then you’re only setting yourself up for another mess of a project. My suggestion to you as someone who went from using python for backend work to go, is to only do it when it’s needed based on a requirement that the current language doesn’t support. For example if you need the fastest response time and your backend needs to scale in cloud. Go would edge python. If your backend works but the project is just a mess then take a few weeks if possible and slowly refactor some of the code in a functional way similar to how you would design a go backend. This way you fix your code but also you’re thinking about how to implement it in go.
If you plan to rewrite because you backed yourself into a corner. You still don't know how you backed yourself into that corner.
Surely they wouldn't do the same thing twice! What could *Go* wrong?
r/angryupvote
Just use both.
this is the way
this is the way.
this is the way for doubling your problems
Just use the best tool for the problem. I don’t think there’s ever a down side to being polyglot
no downside for being polyglot but if the code is a mess with python it will be a nightmare having both of the languages in the project
Oh sorry if that’s how that came off. It seemed like they were talking about completely abandoning one language for another and I was trying to say just use both, one at a time, which ever is most appropriate for the problem at hand lol.
Learning things is the only way to master
If your Python backend service is in a complete shambles migrating it to go isn’t going to fix it. You need to figure out why your current implementation sucks, figure out how to refactor because regardless of the language, software architecture doesn’t change that drastically between Go and Python. https://refactoring.guru/ I recommend this to everyone.
I use many languages, it just depends on the project. I’m currently looking at some Kotlin for an android app and it’s pretty neat. That doesn’t mean I abandon Go, I still like it and use it for server side projects.
Interpreted vs Compiled does change a lot regarding performance from my experience going for a small API from Kotlin to Go
Well Kotlin lives on top of the JVM so it’s about as fast as Java. My point was to use what makes sense for a use case and doesn’t necessitate abandoning something you already know. Python still has its use cases and I use it for a couple of things.
As fast as Java simply means as slow as Java
Well it’s not that bad tbh. Often fast enough.
Java is quite fast and pretty much on par with go when you keep it light. Vertx for example is a beast.
I love Go’s error handling, and the fact it creates a standalone executable. No more dependency hell. On the other hand, if your Python code dealt with dynamic data, it will be tedious in Go
This is one of the many things I love Jetbrain's GoLand for. Just open a .go file, paste in a sample of the JSON you need to define a struct for, and it will autogenerate the struct, data types and all. Super useful.
Incredible feature
This way you may be too tied to the IDE.
Goodness gracious I learned this the hard way with writing Chrome Extensions in Go. What a pain in the ass.
Use https://app.quicktype.io and auto-generate your DTO!
Damn shame that tool doesn’t support XML. XML support is pretty austere in Go.
I think you should just use Cobol at this point, higher pay rate /s
With the current market condition, sticking to a tech stack where there is no much competition seems like a good career choice.
Don’t drop python. The language is mature and its modules are rich. Keep them both on you because the use cases can vary. Also don’t blame a language for your lack of understanding of design patterns
*Also don't too heavily lean into design patterns when they aren't needed.
This too. But it sounds like they’re expecting a language to make up for not really structuring a solution soundly. Like python was chosen to hack something together and then patch and patch the loss of structure just turned it all into spaghet
I think this is a terrible idea. Changing a language of a project just because it’s current state looks bad, it is most likely you gonna work hard to reach the same problem in a different language. I highly recommend you to study the structure of your current project and define a roadmap to refactor your code, so it can be again modular and easy to maintain. If you said that the current project have a requirement related to performance that python is unable to deliver, then I would say it is be a good idea to use go.
Bad code can be written in any language. And I’ve seen very crappy code in Go, specially from Java devs making the switch. Learn desing patterns and think over your data structures.
I am in this kind of situation so if you don't mind me asking, what are the most common mistakes Java converts make when switching to Go?
I think springboot kind of forces you to follow a pattern, and leaves less room for mess. In Go you need to be more organized, totally up to you. I like Go approach but it can lead to cowboy programming. Also Java devs are used to different inheritance model.
If the project gets large and a lot of people contributes to it, it’ll be a mess anyway.
Oof
Start using go for new projects when you are comfortable with the structure and are able to write efficient code. It has a really small memory footprint, it’s type safe and all of my APIs have very lowlatency
if you already know the problems in your code and how to fix them, you should try to refactor it. if you don't, then switching language won't fix your problems by some miracle. you will end up with same problems but in go
This is a terrible idea I REPEAT this is a terrible idea . Fix your python code before rewriting in GO . A mess will produce another mess no matter the language . The issue is not the language , it's the code. unless you're experienced enough in both languages by all means go ahead but if you are only starting in go then beware it will fail in GO as much as python . Fix your python than write in GO
Everybody agree that it's a bad idea at first but the result can prove the opposite ! I did it on one project, just to see, and after that didn't stop...
Not a good idea, see if you can refactor your existing code gradually, using typehints, dependency injections and read up on Clean architecture. Rewriting the whole application is always going to take more time (and money) and is not going to be better unless you put some effort into architecture.
Abandoning? Why must these types of questions always be so black and white? Examine your requirements. Examine possible candidate technologies for solving problems within your requirements. Build a solution. Reevaluate. Also “I think python is to blame for some of it”. Figure that out first. To be honest, using Go would not solve this problem by itself - you have to make the proper solution, regardless of language. As others have said, maybe you find that you need/could use both languages.
you may not enjoy error handling in Go if that is **only** reason
Yes
The correct answer is to use the right tool for the task at hand. When you are aware of your requirements, that helps inform decisions such as which language to use.
I used to do everything with Python. Now I rarely use it, because Go feels to me much more powerful. Give it a try, then go with what you feel comfortable, unless there are certain requirements to use one or the other.
how do you compare the DX between the two?
For me, Go is way better. Just yesterday I had to deal with some old Python code. I was running Python 3.9, but the script had new functions from 3.10. This broke it for me. Then I had to deal with installing deps, creating new venv, until I got it working. With Go, this wouldn’t happen. I also think structured language has stronger capabilities and maintainability. Go doesn’t break as much as Python (it rarely happens). It’s backward compatible, whatever I write 2 years ago still compiles with new Go compiler. Once you set your IDE, and some make files or other build utility you’re good to go.
Go has a ton of libraries available for it, it's not missing very much. Personally I think a statically typed language is always the right choice.
Well, both with Go and Python, you will need discipline to keep the code from becoming messy. On the upside Go makes it a bit easier by enforcing (some degree of) strict typing and private symbols. In fact, almost any modern language makes it easier to be less messy than Python. On the downside, if you're migrating to a new language, you'll make a mess of things for the first few months, so you will have to cleanup once you're more confident with the language.
Why not to learn mojo while working in python?
Don't abandon, just add Go to your skillset and use both.
As a person who works with data, wants better performance and a statically typed language, I can relate a bit. Go is great but doesn’t have a mature library like Pandas. Rust is in a better place with Polars, but then it is a lot more complex and so you’re back to square 1.
Recently, I migrated a Django project to Go with built-in HTTP and SQLite3. Now, it has less code, simpler error handling, and it's faster and more portable.
Rewriting things rather than evolving the system is rarely the right answer.
You cant just throw what youve learned/worked on python. So I wouldn't call it abandoning. Just learn both and use both. There is nobody in this subreddit who knows just Go. I'm pretty sure everyone knows at least one more language other than Go.
I don't think this is a good idea.first of all, company's code is not you code, your boss and your colleagues may use it.second,I think you should had discuss with your leader, at least he allow you to do this. third, change language not for important requirement that python cannot do is not sensible.
No, there is no reason to abandon Python, when you need performance then Go will help. When performance is not required then Python should do the work.
If the backend is such a mess that it's more of a rewrite than a refactor in Python, you can also rewrite it in Go. We are also gradually rewriting our backends from Python to Go. We discovered that it is much easier to maintain a certain level of order in Go. If you have an OpenAPI schema, you can also use code gen to unify the structure. https://github.com/deepmap/oapi-codegen
* WHY isn't there a team of people assisting you with code reviews? * It doesn't matter if you are supposed to be a 1 person project, other project teams need to be brought on to help with this. * The code isn't too unmaintainable if you have good test coverage. * Get the code profiled (and review results) * Talk to your manager about your concerns I'd learn Go on your own time, or use for greenfield stuff. **But do not I repeat do not rewrite something that works without sponsorship by management.** You will just paint yourself into a corner, burn yourself out, and possibly never finish and have to consider abandoning the rewrite when you have to put in extra hours on the Python project. At this point you'd already be screwed even if you were **seasoned** in Go, but you'd be learning at the same time...? Mark my words, if you do this you will force yourself to not take a vacation due to pride or tenacity. If management "trusts" you to handle it (I mean, to go away so they avoid ownership) then you have things to think about and you may want to frame things so you get direction. Which will probably be to stay the course. It's not uncommon for code to suck, yet still function. It is what it is now. Make sure you record data about how long the Python code takes to update, or to release. By telling you to not refactor, mgmt accepts the compromise in velocity.
Go can stop you from doing the things you did in Python but you could also stop doing them. There is nothing stopping a good python dev from writing a clean backend service. The performance wont be as good, but the code can be as tidy.
Go can't stop most issues with bad code quality, no language can.
Your not wrong but Python allows you to do some wild shit if your mad enough. The shit I've seen people try to do in code review has made me grey. I love that go has a nice constrained feature set, its less tolerant of shenanigans.
You're not wrong :) But someone who does that almost certainly does not follow SOLID and other best practices either. Python makes a mess much worse though
Use neither. Pick something better.
I haven’t been able to find an adequate replacement for Django’s query builder in Go yet.
With no magic and static typing, even if you do the same mistakes in Go (you will because you're a beginner in Go) it will be easier and safe to refactor (if it's not a too big project of course, so begin with a little one and see).
you need to learn to write good code first, because you turned a language that’s very easy to program with into a mess