Why did you choose Go?

agolangf · · 462 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>For you devs who didn&#39;t start out your career with Go, why did you move on to Go?</p> <p>I&#39;ve been an ASP.NET 4.6 dev for 2 years. I feel if I focus further on all things .NET, like the new Core, then I&#39;m not sure I&#39;ll ever be able to easily branch out as my career grows. </p> <p>Don&#39;t put all your eggs in one basket right? </p> <p>I&#39;m branching out with Go because I love that it&#39;s statically typed and compiled (I hate JavaScript btw). It&#39;s a natural transition going from C# to it. Go is fantastic in its power for rapid development. I&#39;m already building little tools here and there after playing around for a couple of weeks. Awesome stuff.</p> <p>Anyway, what do you think of your Go career now compared to your development past? </p> <hr/>**评论:**<br/><br/>carleeto: <pre><p>Good question. Ok let&#39;s see...</p> <p>I started off with assembly and BASIC because I wanted to control hardware. One was fast and the other was easy. </p> <p>I moved on to C, which to me at the time seemed almost as easy as BASIC, a lot more expressive and almost as fast as assembly.</p> <p>I moved on to C++ because of object oriented programming. I was a junior then and it seemed like a powerful way to model the real world. I spent over 10 years in C++.</p> <p>Along the way, I dabbled in Python (to write tools quick), PHP (web), C# (to see what something like the .NET library that had networking and threads felt like). This was before C++11.</p> <p>Just after C++11 was released, the time it took for various compilers to catch up made me realise that I wanted a language without a pre-processor, without header dependency loops and with one standard compiler.</p> <p>I also did not want to learn about garbage collection strategies just to get more performance out of my code, because the idea of not having compete control over garbage collection runs was unacceptable to me. </p> <p>I wanted a language with an official compiler that worked on all the platforms I was interested in (Mac, Win, Lin). C++ didn&#39;t have that. </p> <p>I wanted a language that built in under a minute because I had come to love Test Driven Development and I noticed that the build time delays were getting ridiculous. </p> <p>A nice to have would also be that the language built static binaries because I hated writing tools and sharing them and then have them not work because some stupid DLL or library was missing.</p> <p>I wanted a language with built in support for standards compliant networking, serialisation and a nice, natural way to express when code should run in parallel - I had looked at threads, queues, lock free code, wait free code, parallel for loops, etc. and each worked well, but did not feel natural. I just needed to express concurrency naturally and it needed to work regardless of the number of cores or the architecture.</p> <p>Last but not least, I wanted a language whose source I could read and learn from. Ideally, the source wouldn&#39;t look like gobbledygook but would be commented on the why.</p> <p>So all these ideas were kicking around in my head when I heard about Go. I kept an eye on it for a while and it only seemed to be growing, so I decided to check it out by first watching Rob Pike&#39;s 2009 talk on it (<a href="https://youtu.be/rKnDgT73v8s">https://youtu.be/rKnDgT73v8s</a>). </p> <p>I was blown away. It was like somebody had taken my wish list and come up with a language to suit it. It felt so natural I had to try some code. A week later I was hooked because of simply how productive a language Go actually is. It is amazing how much more you get done when you don&#39;t have to think about whether your HTTP implementation is up to scratch or how to deal with Unicode, or how to calculate time.</p> <p>The biggest bonus for me? It favours composition over inheritance. </p> <p>I still am hooked years later. Still enjoying the language. As for garbage collection? I can totally live with a maximum pause of 10 milliseconds for GC. As of Go 1.8.1, that typical pause is now more like 100 microseconds.</p> <p>So why do I like it? Because it makes me focus on the problem I&#39;m solving and not on the technology I might need to use to start solving it. </p></pre>cs-guy: <pre><p>Let&#39;s see, I spent ~6 years with C, then 9 years with C++. Then I reluctantly switched to Java (for 7 years) because the job was interesting enough, but over time came to appreciate that Java had fewer dark corners and was more easily cross-platform than C++. My switch to Go was more purposeful. I like the simplicity and design of Go better than the languages I used before. I agree with the philosophy behind Go and like the ecosystem and community that has built up around it.</p></pre>acidProtestCarnival: <pre><p>I haven&#39;t really adopted Go in earnest yet, but for me the dropping of inheritance in favour of composition is pure genius.</p></pre>_ak: <pre><p>Similar here: several years of C, a few years of C++, with the occasional Perl and Ruby sprinkled in. Then Go came along, and its concepts and simplicity at first made it feel like a 21st century C, but then it also reminded me of my time in school when I did quite a bit of programming in Pascal.</p> <p>Go has been my day-to-day language at work for more than 3 years, and it&#39;s also my language of choice for private projects, and I don&#39;t see anything else coming along to replace it in that role.</p></pre>nikdeapen: <pre><p>There are a lot of things I dislike about Go but there is simply no other language that offers GC with sub-ms pause times, built-in co-routines, and widespread support. All three of these are crucial for the software I build. I also considered C and Rust. I did not choose C because it is a pain to manage memory and abstract types. Rust was a good option but it is lacking in support specifically in their standard library and IDE options.</p></pre>shazow: <pre><p>I like many aspects about Go. I like the aesthetic, I like the community, I like the static typing and fast compiler and many more things. But the #1 reason why I embrace and recommend Go:</p> <p>It&#39;s a powerful language that is easy to learn and hard to make a mess.</p> <p>This makes working with other people on Go projects much more enjoyable than most other languages. Beginners can start doing useful work within a day or two and the excellent opinionated tooling with good defaults helps keep them on track.</p></pre>divan0: <pre><p>Before Go, I used mainly C++ and Python, and was constantly frustrated with complexity and performance respectively. At some point I realizied that I am not enjoying programming anymore. It was constant fight with language or tooling, and it was so frustrating that I almost had lost my interest in programming. It wasn&#39;t fun anymore.</p> <p>After discovering Go, I tried it on a couple of side projects and I couldn&#39;t believe how extremely productive I was. I started doing some weekend projects, testing out different ideas that were in my mind before but never came to reality simply because it was a suicide to try implement them in a weekend with C++. In other words, Go returned my passion to programming again, and, due to it&#39;s opinionated design, learned me some good practices, including proper error handling. It made programming fun again.</p> <p>Almost 4 years so far, and I feel almost the same productivity boost as it was at the very beginning of my experience with Go.</p></pre>renewedhope: <pre><p>node &lt; go</p></pre>shark1337: <pre><p>Kinda have to agree here. I switched to golang because it has concurency out of the box without callback hell or other async stuffs. It&#39;s amazing for web development, that&#39;s the main reason I use it and planing to start production with it. Fun fact: I&#39;ve a job based on node js and javascript, but wouldn&#39;t mind finding osmething based on golang at all :P</p></pre>renewedhope: <pre><p>I also am enjoying not having to play around with 1,000 different things just to get my code running.</p> <p>Javascript/node provides for such a huge distraction in that area, where go just works and is easier to not tinker with and just code.</p> <p>Still gotta deal with JS on the frontend. Gopherjs does not look at the moment yet something that I would want to use in production, or ever will.</p> <p>Our project is using flow type checking... but am really considering looking into Typescript instead. I am not a fan of all the configuration one must do to get flow working properly.</p> <p>Very interested in elm as well.</p></pre>ActualDonaldJTrump: <pre><blockquote> <p>I also am enjoying not having to play around with 1,000 different things just to get my code running.</p> </blockquote> <p>This is one of the primary reasons I like Go, as well. The standard library has just enough batteries included for 90% of the stuff I want to do. For the other 10%, dependency management is nowhere near as good as, say, Rust and Cargo, but it seems to be getting there with the dep tool.</p></pre>parnacsata: <pre><p>I fiddled with NodeJS for a year, but eventually I came to the point where I wanted to try out some new language for fun. Well I made a list consisting of Rust, Go, Dart, and a few others. I choose go, and now my life is easier.</p> <p>I didn&#39;t had serious problems with node, but those callback hells... I still have nightmares.</p> <p>After a week with go, my mind was blown.</p> <p>Ninja edit: I&#39;m not a developer. </p></pre>exch: <pre><p>I spent most of late-2001 through 2009 in C#. In the early days, .NET was still in beta. I liked C#. While I learned a bunch of other languages along side it, C# was my main thing. But towards the end, I got more and more frustrated with some little ugly bits of C#. To the point where I couldn&#39;t stand the language anymore.</p> <p>By that point, I ran into the open source release of Go and I was immediately sold. While C# potentially still has some uses, almost all my time is spent in Go. Also, since I started working with it, I have become much more at home with C and various flavours of assembly.</p> <p>The one thing that bothered me most about C# was the annoying amount of boilerplate one had to write for every single new thing. That, plus the &#39;everything is an object&#39; mantra. I really don&#39;t feel that adds any value at all. Go was a breath of fresh air with its simplicity and (for me) novel approach to OOP. Plus not having to write a class for something that is fine as a global function, was amazing. C#&#39;s brand of OOP definitely has its uses, but it isn&#39;t nearly the be-all-end-all that some people seem to think it is. Go is not perfect, but as the right tools for the right jobs goes, Go fits a lot of those jobs very nicely.</p> <p>Go also taught me to let go of 8 years worth of indoctrination over what constitutes &#39;best practice&#39;. While I will never be as awesome as the likes of Ken Thompson, reading Go&#39;s source and being exposed to the Go community, has made me a vastly better programmer in just 1 or 2 years since 2009, than all the previous years combined.</p></pre>Yojihito: <pre><p>But Go has also a lot of boilerplate?</p></pre>exch: <pre><p>Not nearly as much in my experience. I&#39;m sure something about Go will start to annoy me at some point, but I&#39;ll enjoy the ride while it lasts. It&#39;s been 8 years now and I&#39;m still happy to write stuff in Go.</p></pre>karma_vacuum123: <pre><p>the Go designers cheated and hacked their way in at least one case: struct tags. doing that stuff in Go would have resulted in too much typing, so they just grafted on a junk drawer for their private DSLs where needed. what an awful hack</p></pre>exch: <pre><p>I don&#39;t think I&#39;ve ever heard the struct tags be a problem for anyone. I agree they are not ideal, but having written a en/decoder a-la json or xml, I appreciate having them.</p> <p>I do feel it&#39;s a good example of Go&#39;s pragmatism. It&#39;s not meant to be a beautiful language. it&#39;s just meant to get the job done with as little fuss as possible.</p></pre>JackOhBlades: <pre><p>Go is flexible where it counts in a lot of ways (things like implicitly satisfied interfaces). The boilerplate Go has; Java and C# have, and some. </p></pre>Pythonistic: <pre><p>Here&#39;s most of the content of an email I sent to my Lead Link on why i choose Go to implement a single sign-on service rather than Java (the previous language) or a different language.</p> <hr/> <p><strong>Go (and why not Node.js or Rust or Python or Java)?</strong></p> <p>Go was a tough decision. I hadn’t touched the language since January 2015 so I wasn’t going to be up-to-speed in a heartbeat, but it did have some advantages over other languages:</p> <ul> <li>I love Python and it would certainly have been a fine language to use for SSO. Throw flask into a virtualenv, add modules for LDAP and RSA, and you’ve got a stew going! It’s a very readable language (although it suffers once you start tossing too many annotations at it), and what it loses in execution time, it makes up for in fast development. The downsides were that it would need a bit more environment configuration up front, we’ll be chasing Python versions on servers (like we currently do with Java versions), and it’s significantly harder to prove you’re doing it right at compile time.</li> <li>Node.js was a top-three contender. It’s got a lot of great module support, almost everyone knows how to read and write Javascript, and you’re your scripts are correctly written, it’s a really fast environment. The biggest downside was shared with Python. Because interpretation happens at runtime, syntax or coding errors won’t show up until unit test (if you’re lucky) or production (if you really messed up).</li> <li>I strongly considered Rust. It’s got good (unsafe) integration with native libraries, has compile-time borrow checking for variables and memory, and has support for generics, traits, mutable and immutable fields, etc. However, if Go was going to be a stretch for the environment, Rust would be doubly-so. The first time someone tried to do maintenance on the code and ran into compilation errors because of immutable fields or double borrowing a variable would cause unnecessary pain. Sorry Mozilla: I love your language, but I’ll keep using it at home for now.</li> <li>Erlang was a surprisingly strong choice. It’s got great web frameworks (including the standard Elixir) and a concurrency and failure model that would leave me very confident in that choice architecturally. I’ve used Erlang in RabbitMQ and, once I got over the environment problems, was very pleased with the speed and reliability of the system. Erlang makes Rust look easy if you didn’t read SICP or write in functional languages. There’s no way I’d expect it to be maintainable.</li> <li>If I was going to write it in Java, I’d spend the next week evaluating which libraries are the best ones to do each job. And then I’d wonder why I’m changing languages instead of ripping out parts of CAS. Everybody “knows” Java, but in talking to people around me at work, deep knowledge of these frameworks is spotty at best.</li> <li>Go is the reluctant hero of this story. It compiles to a single executable for very easy deployments, supports static linking so I can distribute one binary with the VM, all the libraries I need, and all my compiled code, and it’s strongly statically typed with a compiler that flags many classes of error. I can start the SSO server essentially instantly. From personal experience, linking to native libraries is very, very easy – even OS X dylibs – and it runs fast enough that my SDL programs needed sleep timers to be usable. Downsides are that the company&#39;s developer community isn’t familiar with it, that a lot of the libraries aren’t as mature as Java or Python, and that package management and versioning are abysmal compared to Python or Java. Because of this, I’m avoiding as many third party libraries as I can and sticking to the standard library implementations (e.g., using html/template instead of Hugo).</li> </ul> <p>If a programmer has used C/C++, Java/C#, and Python, Go will be very familiar and easy to pick up. It’s got pointers (the way C should have had them), a garbage collector (no more malloc/free), and interfaces instead of objects.</p> <hr/> <p><em>Edit:</em> What do I think about my career with Go versus other languages? I was an early Java adopter, writing in it back in beta, while I followed but didn&#39;t develop with Go until version 1.1. Unlike Java, which took off surprisingly quickly (probably because Powerbuilder and Visual Basic were really bad for web development in 1997-1999), I don&#39;t expect to be finding a lot of &#34;Go&#34; consultancies offering teams of programmers for enterprise projects. The language landscape has grown too diverse. In my company alone, we&#39;ve got people doing Java, C++, Ruby, Perl, Python, R, Go, Node/Express, Angular, React, and Elixir for new development on a daily basis. In 1996 it would have been C/C++ and Visual Basic or Powerbuilder, and in 2006 it would have been Java (and maybe C++ or Perl).</p> <p>I expect it to be a lot like Python: I didn&#39;t get strong interest from recruiters for Python until 2014-15, and even those are significantly fewer contacts than Java development. Go will pick up with time, but having experience in hard-to-find protocols (like SAML) or specialized systems (like FileNet) will still get more recruiters each month than just saying, &#34;I know how to write in Go.&#34; Treat Go as another tool in your belt, but don&#39;t expect it to define your career like Java or C#.</p></pre>jugalator: <pre><p>Native apps, easy as breeze to distribute with little cruft, cross platform, even simple cross compiling, packaged in an easy to understand language with solid backing where the developer understands the importance of not just adding on features but also when to say no. Go had many things going for it for me.</p> <p>In practice, I began liking Python but with Go it felt like taking Python and basically fixing all of the major problems:</p> <ul> <li>Slow? Oh that&#39;s a main feature: Native compiles.</li> <li>Parallelization issues due to GIL? Oh that happens to be a main feature: Goroutines.</li> <li>Distribution issues requiring py2exe etc? Oh static compiles happen to be a major feature.</li> </ul> <p>It&#39;s like they took major issues of Python and focused on those in particular. I have no idea if it&#39;s just coincidence but in any case, it&#39;s no surprise Go is currently rising quickly in web development circles.</p> <p>Personally I think it feels kind of like a higher level C (not C++!) language, and I like that. It&#39;s... contained and basic.</p> <p>Rust is also nice but I think Go feels more pragmatic and Rust more academic.</p></pre>steven447: <pre><p>I have been a full stack web developer for years. I have build things with advanced PHP frameworks and the latest frontend tech like Vue.js and Gulp. I felt like my skills in PHP and Javascript were stagnating, so I wanted to learn a new platform. Further I wanted to expend my skills by mastering a strongly typed language.</p> <p>I have experimented a bit with Java, C# and C++ in the past. So lately I have been reading about them, but I found them too verbose and bloated compared to my experience with Javascript and PHP.</p> <p>Than I saw GO and loved it instantly. It has the simplicity of Python, but is strongly typed and contains a lot of awesome features like <code>go fmt</code>. </p> <p>Currently I am reading and experimenting a lot. At the end of the summer I want that my Go coding skills are on the same level as my PHP/Javascript skills. Afterwards I want to make Go together with PHP and Javascript the 3 pillars of my career.</p></pre>QuantumHunky: <pre><p>I&#39;m using Perl since 2001. Some day I read article by former Perl-programmer about Go, and I wanted to try. I like it. Though it is very hard to understand and keep in mind everything, making first steps now.</p></pre>diegobernardes: <pre><p>I came from Ruby, Go was amazing from day one, things tend to work on the first run. Refactor is easier and the best, you know what is happening, everything is written by you, this involves more programming, but at the end, it pays off. </p> <p>Another thing that got me was the concurrency and the error handling. Yes, the error handling, my programs now are wayyyyy more safe. Can&#39;t came back to try catch style programming anymore. And the concurrency it&#39;s just at another level, the always async runtime while the code is sync it&#39;s amazing.</p> <p>But that are other languages in this same scope like Rust and Elixir. Rust is still kinda beta to me, have fewer packages, way harder to program, but way more potencial. Today i&#39;m mostly on Go and Elixir.</p></pre>pinpinbo: <pre><p>I subscribed to CSP idea long before Go existed.</p> <p>Unfortunately, all of the implementations I know (before Go) are either obscure or unpopular: Lua, Tcl, Stackless Python, etc.</p> <p>So when Go happened (plus Google backing), I quickly hopped on the bandwagon.</p> <p>Couple that with a lot of other pluses like single binary deploy, they make me a very happy user.</p></pre>mi7chy: <pre><p>Learning go and what makes it nice is I can install Go 1.8.1 on my phone with free Termux app.</p> <p><a href="https://play.google.com/store/apps/details?id=com.termux" rel="nofollow">https://play.google.com/store/apps/details?id=com.termux</a></p></pre>albatr0s: <pre><p>Go chose me!</p></pre>BeepNode: <pre><p>I haven&#39;t tried go yet but what&#39;s intriguing is that it&#39;s being used to replace both app dev (c#) and scripting (python) languages. </p> <p>I&#39;ve been using python for automation with cloud functions (only moderately proficient) and it looks like I need to give Go a look. </p></pre>carsncode: <pre><p>I&#39;ve worked with more languages than I can count, and I came to understand what I liked and disliked in a platform. I wanted simplicity, a rare commodity after working with Java and C#. I wanted static typing after nightmares with PHP and JavaScript. I wanted something compiled, but quickly so it wouldn&#39;t slow down iteration. I wanted something easier to thread than Ruby or node. And I really wanted something that could be deployed with no dependencies, after working in DevOps for a while and getting tired of having to install Java and Ruby and node and Python and so on just to run other programs. I wanted to write self contained software and I didn&#39;t want to resort to docker to do it.</p> <p>I came across Go when working with Consul as a DevOps engineer. I started following HashiCorp and learning more about Go, and decided to mess around with it. I usually pick up languages pretty quick but I was productive with go faster than almost anything else I can think of, and it makes writing simple code the natural thing to do. I&#39;ve been working with it for a couple years now and haven&#39;t moved on yet.</p></pre>eikenberry: <pre><p>Pre-go I worked mostly with Python and C for years. I was always experimenting with different programming models and was trying out flow based programming using generators at the time I read about Go. Seemed the perfect fit and it was. So CSP drew me to the language, the simplicity and tooling made me switch to as my primary language and I haven&#39;t looked back.</p></pre>circuitously: <pre><p>I come from the other side. Web Dev in PHP, Laravel specifically. Last year I picked up Python, which felt a lot nicer than PHP. Having heard a bit about Go over the years, the final straw for me was watching some tech talks by the engineers at a certain startup bank that uses kubernetes and emojis. Most of their microservices are in Go, so I though why not, and haven&#39;t looked back.</p></pre>Kraigius: <pre><p>I&#39;m always interested in learning new tech. Seeing that Go is a language that was created out of need and that it was gaining some traction, I wanted to jump on the bandwagon in case good job opportunity arrives.</p></pre>jringstad: <pre><p>I wasn&#39;t the one making the call, but...</p> <p>As it tends to be, the choice was somewhat arbitrary, there were probably many valid alternatives we could&#39;ve choosen. We needed something to build a relatively complex API and processing pipeline, so we needed something that supported a reasonable amount of concurrency out-of-the-box, that was relatively fast, that could talk to other HTTP services (particularly AWS) without difficulties, that had a good-quality postgresql library (not an ORM -- all of our SQL is hand-written.)</p> <p>Absolute throughput or performance was also not a huge concern for us, so we preferred something that did some basic hand-holding for the programmer (managed memory, typesafe, safe containers etc.) We preferred static typing. We also wanted something easy to build and deploy. For these aforementioned reasons, C/C++ was not the best fit. Erlang provides even more of some of these guarantees (like hypervisors for added resilience) but its syntax is too obscure, talent is too hard to find and it&#39;s library ecosystem isn&#39;t that mature. Using systemd units and breaking up our service into several microservices replaces the role of hypervisors in erlang for us sufficiently (a big part of our infrastructure is various services that retrieve jobs from queues (mostly database tables) and slowly process them asynchronously, so if they go down and get restarted, that is mostly no big issue.)</p> <p>Rust wasn&#39;t mature enough at the time. Maybe it could&#39;ve been a choice now, since it gives some really nice extra safety guarantees, but maybe not, since syntax and semantics are quite a bit more complex than many other languages, which would be an issue for us (we have quite a few junior devs and interns and such.)</p> <p>Python would&#39;ve probably been the closest second choice, since most everyone of us already had a background in python (as well as C and C++.) Ultimately we still managed to have a couple of reliability issues like leaked filehandles/goroutines etc in a couple of places, but I&#39;m sure it would&#39;ve been worse with C/C++ (maybe we wouldn&#39;t even have let some of the juniors write code, had we chosen C/C++. We still have some amount of C++ code in our codebase, but it&#39;s relatively minor, less than 4kLOCs). CEO/cofounder at the time was pushing for PHP, but none of the technical staff was on board with that, and Go was pitched by someone as alternative, and then it just happened. </p> <p>There is still some friction in that new people have to learn Go, and it&#39;s usually a little different to what they&#39;ve used in the past. This would probably be less of an issue with python, but it&#39;s still better than it probably would&#39;ve been with erlang or rust, I reckon. Either way, it&#39;s not too big of a deal to us, at least at the moment.</p> <p>Go also works great withhin a containerized environment, which wasn&#39;t a criteria at the time, but worked out well for us.</p> <p>I personally don&#39;t expect to use Go again in my career if/when I stop working at this place, since it&#39;s still not that mainstream. I personally feel no allegiance to any kind of language in particular, but except for a couple minor exceptions, working with Go was pleasant and I would not object to doing it again.</p></pre>BasedFollower: <pre><p>I previously had learned/used C++ (then Python) before, and while I appreciated those languages, I also had some gripes; C++ became very unreadable and I was always fighting the compiler, whereas with Python, there wasn&#39;t any type-checking, eventually became unreadable (I don&#39;t like reading Python code anymore, oddly), and was not able to upload my package to PyPi and install it successfully. Go, however, in the two months that I had used it, was easy to learn after knowing those two previous languages (including its different syntax), had a rich ecosystem that made sharing packages easy, and addressed my problems with C++ and Python. Unfortunately, I don&#39;t work with the language now, but I&#39;d like to return back to it soon.</p></pre>kaeshiwaza: <pre><p>First I choose Go because i needed something faster than Python. I was very surprise by the simplicity of the language, more Zen than Python himself ! So i tried it with simple apps and was convinced that it will be more maintenable. Now I cross my finger that Go will stay as long as Python without the pain of a breaking changes like Py3.</p></pre>oscooter: <pre><p>I worked in C#/.NET since I graduated college ago 5 years ago (it feels so much longer). My last job was good, I was happy working in Xamarin on a daily basis. Then I got an opportunity to interview for a job that I couldn&#39;t turn down.</p> <p>I learned go the day before my flight and a finished the playground on my flight to the interview. I figured I&#39;d know enough to know the basics. But, that&#39;s when I realized I had pretty much learned the entire language. I never realized how nice a small language can be. It doesn&#39;t have as many rough edges as other languages I&#39;ve used. It&#39;s fast. </p> <p>I wound up landing the job and have been working in go and javascript for about the past 6 months. It&#39;s been a hell of a time.</p></pre>SaturnsVoid: <pre><p>It was new and i noticed you could do most anything i wanted in it. I also like the syntax</p></pre>Mteigers: <pre><p>I had been a PHP dev for quite a few years prior to being exposed to Go. I felt like PHP had too many layers of abstraction and was holding me back as an engineer. I didn&#39;t really know what was going on with HTTP, how sessions really worked, what a pointer was, what the difference between int and uint was, and so many other computer science basics. </p> <p>Go forced me into learning these and now that I now what a session is for example I know how to scale sessions to hundreds of machines </p> <p>The other thing is I always wanted to try and get into more &#34;powerful&#34; languages (read compiled). As someone never exposed to a compilation process I could never figure out C++ or Java build processes, all of the hoops you had to go through and you couldn&#39;t just send a binary to a buddy to run or to a server to run. Also as a PHP dev I was guilty of the tweak and run. Make a small change run it see how it works. That never worked on other languages. Go allowed me entry easily. Easy build process with <code>go run</code>, fast compilation times for guerilla programming. </p> <p>When I was writing PHP I felt nothing more than a programmer, just an extra set of hands. With Go I feel more like an engineer, I know the effects my application will have on the operating system (as good as anyone haha), I know the entire HTTP stack for my application. </p></pre>no1youknowz: <pre><p>A few years ago, I heard of a company which developed an ad server type application in Go. I was surprised. Although I hadn&#39;t heard anything about it at that time. I wondered why not C++ or Java, or heck PHP. I mention PHP because some other ad server tracking software is written in PHP, such as prosper202, imobitrax, Funnel Flux. There are others I am sure.</p> <p>Anyway, it came to needing an in-house solution as then the current players didn&#39;t have the custom features required. I rolled up my sleeves and wrote out an MVP over a weekend.</p> <p>200rps. That&#39;s all it was able to do. I looked at many tutorials, spoke to many people. They all blamed the database. It must be the database. Look at your indexes, yada yada. Nevermind it was actually wired up to redis lol.</p> <p>Changing from Slim, to Codeigniter, to Lumen. Performance either got worse or it never really broke 250rps.</p> <p>Lets be honest, someone even brought up a similar story: <a href="https://www.reddit.com/r/PHP/comments/67st8w/lumen_laravel_sham/?st=j24khbuc&amp;sh=9167d68f" rel="nofollow">1</a>. Which of course, someone suggested he had an agenda.</p> <p>But wait, Taylor of Laravel fame recently posted: <a href="https://medium.com/@taylorotwell/benchmarking-laravel-symfony-zend-2c01c2b270f8" rel="nofollow">2</a>. A mere 521 rps.</p> <p>But really, I am just proving the point of my story. PHP was a poor substitute for what was really sorely needed.</p> <p>I then learn Go to a decent extent over a weekend. It&#39;s really easy to learn. Over the course of a few weeks. I have the same MVP which has the same functionality as the PHP MVP.</p> <p>The result? It completely and utterly destroys PHP. What would require dozens of high-spec servers running PHP to handle the load that was required. Only 3 servers running Go would be needed.</p> <p>Fast forward to now. Whenever I need heavy lifting or micro-services. It&#39;s all done with Go. PHP has pretty much been relegated to handling sessions and some front-end business logic.</p> <p>Unfortunately, I&#39;m not sure I will ever leave PHP. As there are many libraries in composer that I still use and it&#39;s not available with Go. If there was parity between the two, then I would move over in a heartbeat and migrate over to VueJS for the front-end.</p> <p>That said. I don&#39;t see myself using PHP in 2022. It&#39;s like Python. I never use it now. I see myself just developing in Go and JS (VueJS).</p></pre>drink_with_me_to_day: <pre><p>Because Go is ok for web apps and it&#39;s perfect for enterprise: no need for a complex env. setup, installation, etc. No need for expensive PHP &#34;encryption&#34;, obfuscation, etc.</p> <p>Send one binary file, and gg.</p></pre>natefinch: <pre><p>I was just like you. I started in C++ and then moved to C#. It was a fine language but got pretty bloated as they added more and more and more... but more importantly to me, was that I didn&#39;t want to get pigeonholed as a Windows developer. I knew that windows development will only reduce in volume as more services go online, and Linux development is the only thing that makes sense for deploying to the cloud. </p> <p>Luckily, about that time Go 1.0 was released and although at first I thought I wouldn&#39;t like the lack of exceptions... When I actually tried it I loved it. No more worrying about what exceptions I might be missing. Everything was right there in the signature. </p> <p>I never looked back. No other popular language gives you the same benefits right now. Statically typed without manually managing memory. C# is too feature bloated. java is too memory bloated and too hard to control memory usage, not to mention an ecosystem that has way too many bloated standards. Rust is too complicated and the compile times are crazy. Anything else is either dynamically typed (yuck) or not mainstream enough to have a decent ecosystem.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

462 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传