Would Golang be appropriate for a first time language?

agolangf · · 760 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>TL;DR I want to make web apps that are fast, and i want to learn a language that is for the next 10 years top 10, not last 10 years and i have chosen Golang as that language, where do i find books or material for an absolute beginner? </p> <p>I read a quote on quora that went something like this &#34;take a risk and dive into a language that has a smaller user base but seems to be the new up and coming language&#34;. I&#39;ve seen that splice.com, iron.io and parse.com moved either all of their backends or their API from Ruby to Go and i thought, instead of learning Ruby like everyone else, i&#39;ll go in the direction that seems most beginners wouldn&#39;t. I like the syntax of go, funnily enough more so than i do of Ruby syntax. Wheres a good place to read up on programming basics with Go for an absolute beginner? </p> <hr/>**评论:**<br/><br/>sasquatchted: <pre><p>I ran into this blog post titled <a href="https://sourcegraph.com/blog/live/gophercon2015/123565059490">How a complete beginner learned Go as her first backend language in 5 weeks</a> a while ago. It&#39;s both inspirational and has a great set of resources for getting started (though most already mentioned here).</p></pre>godownforwhat: <pre><p>Great find, thanks!</p></pre>chappell28: <pre><p>I have personally found that Go&#39;s simplicity and readability has dramatically improved my pace of learning and overall understanding of software-engineering concepts, as well as how to apply them in a variety of situations.</p> <p>Go gives you the tools you need to create good software, and nothing more; it&#39;s easier to focus on what&#39;s important when you don&#39;t have distractions like whether to use camelCase or under_scores and tabs or spaces. </p> <p>In addition, the Go community&#39;s preference toward using the standard library over frameworks discourages &#39;magic&#39; and prevents you from creating software without understanding how the underlying code actually works.</p> <p>The only significant problem I encountered using Go as a first language is that a lot of content and documentation frame things in terms of &#34;How x works in Go&#34; rather than &#34;How x works, coincidentally in Go.&#34; As a result, I sometimes find myself having to supplement tutorials and guides with complementary explanations for C or python -- conceptual overviews utilizing pseudocode works best, when available.</p></pre>godownforwhat: <pre><p>I think i will use my Python lessons with Go on the side with a direction towards building with Go, but understanding the basics with Python. So i can look at lots of tutorials of the basics in Python then do them in Go. I think that&#39;s my guide for this.</p></pre>r053bud: <pre><p>Are you a beginner programmer or a beginner at Go? If you are a beginner programmer, the language you choose is not as important, what is more important is to really learn the fundamentals and choose a language that has a large community and tons of resources to learn from. I love Go and use it at my job, but I would have a hard time recommending it to a complete beginner...I usually recommend Python in that situation.</p></pre>godownforwhat: <pre><p>Would Python as a first language and Go as the secondary be a good step? Go should complement learning Python? I already have some tutorials done with Python. Edit, spelling.</p></pre>printf_hello_world: <pre><p>Go as a second language sounds like a pretty reasonable plan.</p> <p>However, you should probably only move to Go after spending enough time with Python that you can appreciate the parts where Go is stronger (performance and concurrency, mainly). If you haven&#39;t had problems yet, stick with Python.</p></pre>r053bud: <pre><p>I think that&#39;s a great path to take. Python will allow you to build 90% of ideas you might have, and Go will take care of any software that needs to be highly performant. </p></pre>Streamweaver66: <pre><p>Yes this would be a good plan. The original reply has some good advice and reflects my thinking as well. When I originally read your question I thought Go might be ideal to learn as a first language because some of the difficulty is overcoming paradigms baked in by other languages. Thinking more about it though It think Go unintentionally makes some assumptions in the reader being familiar with concepts like pointers, iterators and the like. </p> <p>Python is a great choice for a first language, it&#39;s powerful, has a great community and study after study shows it&#39;s easy to learn and retain. </p> <p>The good news is that both Python and Go are very easy to learn relative to most programming languages and the tooling to use either/both is very light as well so the barrier to entry is low. </p> <p>Good luck to you and let us know which way you decide to go and I&#39;d look forward to hearing your experiences after a few months.</p></pre>hyperforce: <pre><blockquote> <p>If you are a beginner programmer, the language you choose is not as important</p> </blockquote> <p>I&#39;d disagree here. I could obviously choose a horrible language like BASIC or Malbolge to illustrate that the choice is important.</p> <p>Obviously among mainstream languages, this is less of an issue because they&#39;re likely very similar.</p></pre>r053bud: <pre><p>Sure, same argument could be extended to learning Assembly...not that important when just starting out. Valid point. </p></pre>jkoudys: <pre><p>Learning good fundamentals is the most important thing for a new programmer, which is exactly why I think it matters which language you choose. There&#39;s a whole crop of developers who started on PHP4, which is full of bizarre and inconsistent behaviour, and the code examples beginners would follow were equally terrible. There are also languages where the ecosystems can be daunting for a complete beginner to navigate, such as JavaScript. On both those counts, I agree that Python is a great language for a complete beginner, since its excellent standard lib and well-established implementations for various patterns are a great starting point.</p> <p>Where I think Go for beginners fits in comes down more to the personality of the developer than anything else. My first language was assembly for the z80 chipset, which practically speaking is far simpler than most modern scripting languages, but learning it requires an interest in how something works, and a curiosity about its implications. Similarly, many new devs grow impatient if they don&#39;t see immediately visible results from something they&#39;re working on, but the kind of beginner who wonders what&#39;s actually running and its implications would love Go. e.g. plenty of new devs would enjoy the easy parallelism from using goroutines, before they even do anything useful with them.</p></pre>donatj: <pre><p>I learned programming with QBasic on a monochrome 286 Epson and I liked it! Kids these days don&#39;t know how good they have it.</p></pre>ericanderton: <pre><p>I learned on C64 BASIC - I suppose Apple][ LOGO would technically count as my exposure to the craft before that, but it&#39;s not much of a &#34;language&#34;. These days, you have the revolutionary concept of having separate pieces of software for editing <em>and</em> running the program; some environments have more than one option of each. Sheer luxury!</p></pre>nhooyr: <pre><p>the go website has all you need. </p> <p><a href="http://golang.org">http://golang.org</a></p> <p>a while ago I was in the same position as you, trust me, you won&#39;t regret it :)</p> <p>Go through the tour and read the documents. Just google anything else. </p> <p><a href="https://gobyexample.com">https://gobyexample.com</a> is also very helpful.</p></pre>koalefant: <pre><p>+1 for gobyexample, that site is great!</p></pre>dhdfdh: <pre><p>Your first language should be C or Python. Python only cause it&#39;s easier to get help than Lisp. C cause you learn how computers work.</p> <p>However, my inclination is to say Go is close enough to C and comes with benefits.</p></pre>koffiezet: <pre><p>C is a good language to know, but does not necessarily have to be your first language. I first learned Basic, then Pascal, then Java and then C and I ended up writing software in C professionally for over 10 years.</p> <p>My current take on it is that Go is excellent as a first language: you have a very simple syntax with limited language and concept overhead. This makes the first steps easy, and since Go makes it surprisingly easy to dive into the std library code, and most Go code sits on Github anyway - looking at how other people do things becomes easy. It also makes investigating how other &#39;higher level&#39; technologies work easier. Let&#39;s not forget that most starters have close to zero technological know-how. They have no idea how a webpage is fetched or even how network connections actually work on application level. A lot of this is &#39;magic&#39; - and having a simple, easy to learn but still powerful language with loads of accessible examples reveals a lot of the workings of this magic and is incredibly useful.</p></pre>dhdfdh: <pre><p>Yes, C doesn&#39;t have to be your first language but you&#39;d accomplish none of the things in your second paragraph with Basic as a first language. And all the reasons you give for Go are what I said, it&#39;s C with benefits.</p></pre>koffiezet: <pre><blockquote> <p>Yes, C doesn&#39;t have to be your first language</p> </blockquote> <p>I meant that although I really like C, I would recommend against learning C as your first language.</p> <blockquote> <p>you&#39;d accomplish none of the things in your second paragraph with Basic as a first language</p> </blockquote> <p>I would never recommend anyone to learn Basic as the first language ;) It was just what provided the initial sparkle for me (well actually, DOS batch files became too limited, so I started looking into Basic). It showed me what was possible.</p> <blockquote> <p>And all the reasons you give for Go are what I said, it&#39;s C with benefits.</p> </blockquote> <p>I&#39;d turn it the other way around: C without the C-specific complications you will encounter sooner than later. Unless you already know a lot about how memory is actually managed, you&#39;ll be off fighting the language and system to start with.</p> <p>Some people will be intrigued by why something doesn&#39;t work, but those are the exception. Most people are encouraged by being amazed by something relatively useful they were able to pull off. They become frustrated by any roadblocks that for them are inexplicable, and eventually give up. And C throws up many roadblocks like that.</p> <p>That said, imho you should always be ready to learn new languages imho, and C (and maybe ASM) is one every serious programmer should learn at a certain point, just because you are confronted with things most languages/runtimes hide for you, which gives you an idea how computers work.</p></pre>dhdfdh: <pre><p>And speaking of assembly, that was my first language.</p></pre>koffiezet: <pre><p>That would actually be a better language than C to start with, it doesn&#39;t pretend to make things simple and then inexplicably doesn&#39;t do what people would expect. You avoid the &#34;why doesn&#39;t it work when I return an array?&#34; or &#34;I return a (stack allocated) string from function X but it is corrupted somehow&#34; questions. I did try to learn someone C as a first language, I quickly switched to something else due to stuff like this.</p> <p>And my (m86k) ASM is pretty rusty these days - only really needed it to write optimized crc32 and crc16 implementations. These days everything embedded is a 200Mhz ARM with loads of memory, no need anymore for such tinkering. It&#39;s still nice to know what really happens, and interesting to see what compilers these days output, but for writing stuff in ASM, I&#39;ll skip :)</p></pre>dhdfdh: <pre><p>I spent three days trying to figure out why there was a dot appearing on the screen, also m68k, till Friday at 3PM when I finally noticed it.</p> <pre><code>MOV B </code></pre> <p>is not the same as </p> <pre><code>MOV.B </code></pre> <p>No errors. No warnings.</p></pre>ericanderton: <pre><p>I agree.</p> <p>I would argue that Go has subsumed most of the area that C covers when it comes to fundamentals of programming on bare metal. Things like pointers, memory locations, stack frames, integer widths, etc are all doable in Go. From there, all the basic data structures and algorithms are easily implemented with same-ish looking code at that.</p> <p>Go does lack some details that C has, but I don&#39;t think that&#39;s a reason to not consider it for first-timers. First, is the utter hackery that C gives you with pointers: that everything is easily turned into an address with a little bit of math and casting. Stack allocated variables are kind of unimportant in Go - it&#39;s more about scope than stack vs heap thanks to the GC. Finally, the Go docs are kind of silent on the distinction as to what is a value type vs a &#39;reference type&#39; - C makes that easy as everything&#39;s a value until you point to it. Overall, it&#39;s not wildly different, but some strict instruction on when and when not to use &#39;&amp;&#39; would be necessary. </p> <p>Then there&#39;s the heap. I would argue that discrete heap management (malloc/free) is a form of resource management that sits between the programmer and the unadulterated process .data/.text memory space. It&#39;s not distinct to C or C++, but it&#39;s also not the default resource manager for all systems when it comes to RAM. To me, a GC (like the one in Go) is no different here; it&#39;s just another resource manager with a harder-to-screw-up API. In the end one really needs to drop to ASM or embedded C to get a feel for managing your own RAM byte-by-byte as one might do in a toy program on a whiteboard. The moment you call (malloc) you have already diverged from classic CS, so targeting a GC based language right off isn&#39;t any worse.</p></pre>calebdoxsey: <pre><p>If you have the time: <a href="http://www.golang-book.com/guides/bootcamp" rel="nofollow">http://www.golang-book.com/guides/bootcamp</a>.</p></pre>kortemy: <pre><p>Besides what others suggested, <a href="https://golang.org/doc/effective_go.html" rel="nofollow">Effective Go</a> is also a must-have bookmark.</p> <p>It shows you exactly how every aspect of the language works, and what is the best way to use it.</p></pre>Mittalmailbox: <pre><p>Go tour is best to start with <a href="https://tour.golang.org" rel="nofollow">https://tour.golang.org</a> Then you can check <a href="https://github.com/astaxie/build-web-application-with-golang" rel="nofollow">https://github.com/astaxie/build-web-application-with-golang</a> It covers all you need to know while making a web app in Go.</p></pre>bat_country: <pre><p>Go would make an excellent first language. It is very simple so learning will be fast. The only downside I can think of is that because it&#39;s so simple moving to language #2 down the road may be a little harder since many language features will be alien. I say go for it and good luck!</p></pre>semi-: <pre><p>I think it would work great. The relatively simple synax makes it a lot easier to pick up and understand existing code, which is very helpful when learning the language -- you just have to figure out what the code is actually doing, not first figure out what all the different syntax sugar and &#39;cleverness&#39; is like you would in some other languages. Also, compared to most older languages, Go is nice because for the most part the stuff you find in a google search is still relevant. When learning a new language that is old, I find it can be hard to tell if what you&#39;re reading is still best practice, or if you&#39;re reading some article about how people solved it 6 years ago that may or may not still work today but is no longer the current best practice. Go lang is newer so that just seems to be much less of an issue.</p> <p>The build process also makes it great for a first langauge, as you can share your work a lot easier than if you had to make your own build scripts and bundling dependencies and all that extra hassle you really dont want to deal with while learning the basics of programming.</p> <p>I can&#39;t really tell you any specific resources for learning it as a beginner, but just going through the go tour wouldnt be a bad start. Like with learning any language, I think the key is to find something you actually want to implement and just start hacking away looking up syntax and such as you go. Maybe look at project euler problems if you&#39;re decent at math (if you aren&#39;t then they still work, but can be confusing).</p></pre>godownforwhat: <pre><p>I also think it would be great. I think over the last couple of days i have looked at lots of languages. Am i right in thinking that Dart, Swift and Go all look very similar? I get they&#39;re all different but they do look very close to me. The more i read, Go seems perfect for learning good strong CS standards instead of learning one framework. </p></pre>aaaqqq: <pre><p>Recommended reading: <a href="https://groups.google.com/forum/#!topic/golang-nuts/ghu1Zpc88io" rel="nofollow">https://groups.google.com/forum/#!topic/golang-nuts/ghu1Zpc88io</a></p></pre>thepciet: <pre><p>Algorithms and data structure tradeoff understanding is required to write fast and/or efficient code.</p> <p>Language tradeoff understanding is required to write understandable and/or maintainable code.</p> <p>Go is just one tool amongst many. You will learn much with it, but not that much more than with another language.</p> <p>The act of making something is the hard part, not the tools. Go make it!</p></pre>michaelbironneau: <pre><p>Other have recommended Python as a place to start. While that is a good choice, the syntax is so different from curly brace languages that I would not recommend it if your plan is to move to Go. I would actually recommend Javascript as a language to start out with, especially if you want to make web apps fast - you only need to learn one language for server and client side and it has certain semantic similarities to Go that will make it easier to transition to Go in a while if you want to.</p></pre>drvd: <pre><p>First: The language is called Go, not &#34;Golang&#34;. Second: Nobody knows which languages will be top in 5 years (or even 10). Third: If you are novice in programming you should invest more time in algorithms, data structures, protocols and <em>security</em> than in choosing a &#34;top language&#34; or writing &#34;fast webapps&#34;. </p></pre>earthboundkid: <pre><p>Fourth: Don&#39;t be lazy. A good programmer knows lots of languages: HTML, JS, CSS, and Bash are the bare minimum languages you need to know to make a website, and odds are you&#39;ll run into several more. There&#39;s no penalty for learning a language and not using it. It&#39;s not like learning a natural language, where it takes years to master. Once you know one language in a family, you can pick up related languages fairly quickly: for example, Ruby, Python, and Lua are mostly the same at the surface level and it&#39;s only when you try to figure out their classes and methods that you run into the parts that are conceptually different.</p></pre>egonelbre: <pre><p>Currently there is resource only for a book for a determined beginner (<a href="https://www.golang-book.com/" rel="nofollow">https://www.golang-book.com/</a>).</p> <p>The &#34;absolute beginner&#34; can mean a lot of things. But here are few additional questions to help clarify:</p> <ul> <li>Have you ever written a program?</li> <li>Have you used command line before?</li> <li>Are you good at STEM fields? It&#39;s not that important to programming -- but it usually gives a good indication of thinking frustration threshold.</li> </ul> <p>If you answered &#34;no&#34; to all of these questions -- read <a href="https://github.com/egonelbre/spark/blob/master/basics-of-programming.rst#a-model-of-problem-solving" rel="nofollow">&#34;A model of problem solving here&#34;</a> and play <a href="http://lightbot.com/hoc2014.html" rel="nofollow">http://lightbot.com/hoc2014.html</a>. See how your mood and frustration levels change while playing the game and try to figure out what to do when you get frustrated. This is one of the major reasons people fail to learn programming -- not knowing how to deal with frustration.</p> <p>If you answered &#34;yes&#34; to all/some of them, then you are probably fine learning from golang-book.com</p></pre>godownforwhat: <pre><p>I know basic HTML, CSS, SASS. But i know i will need to learn Javascript or another language for use with a backend server at some point. I don&#39;t like the way Javascript is written, i like Python and GO so will be one of the two. Python and Go seem similar to me. I am reading, and self learning programming for self use and because i like web technologies. I am an absolute and total beginner and i want to learn GO because i think that&#39;s the biggest &#39;risk&#39; language that will be the next big one.</p></pre>egonelbre: <pre><p>There is <a href="http://www.gopherjs.org/" rel="nofollow">http://www.gopherjs.org/</a> that allows to transpile Go to JS, but it doesn&#39;t save you from needing to know JS. You still need to know how to interact with the DOM. For learning JS there is <a href="http://eloquentjavascript.net/" rel="nofollow">http://eloquentjavascript.net/</a>. For Python there is <a href="http://learnpythonthehardway.org/" rel="nofollow">LPTHW</a>, which is the best book for beginners I know of.</p> <p>Once you know one language it won&#39;t be difficult to move to another language (in the same paradigm).</p></pre>Kimau: <pre><p>So actually I would say it&#39;s a terrible choice if your goal is to get a good foundation in programming. I&#39;ve seen a lot of research into teaching kids to code and have a few friends who are teachers.</p> <p>Aside: This is specific to learning programming not the concepts of logic which is better taught with something like Scratch</p> <p>Basically all the latest research is that high level languages are terrible way to learn (esp for younger learners) and people are much better off starting with basic, assembly or some other more low-level language.</p> <p>Working with say 68000 ASM on an emulator or with real hardware say it teaches the core programming skills, and that there is no real difference between data &amp; code and how registers and stacks work. The abstractions of object oriented programming, garbage collectors and other productivity helpers block learning core concepts. Once you have a good grounding in those systems then the more abstract stuff comes much easier. </p> <p>Best of luck.</p></pre>elithrar_: <pre><p>The problem with learning low-level stuff (even C) is that it takes a lot of work (and a long time) to realize any results (the reward).</p> <p>That can put off a lot of new programmers because they build abstract toy programs that aren&#39;t useful or relevant to their interests.</p> <p>I don&#39;t think there is any one way to teach programming languages because different approaches suit different people. </p></pre>Kimau: <pre><p>Actually not really, visible progress is often more immediate. The progress is making an LED blink or rendering a string of text.</p> <p>I often find past the initial steps higher level languages actually weigh people down. Remember they are learning to program not writing massively scale solutions.</p> <p>Also problem solving and debugging moves faster as they can keep the entire state and machine in their head. There is no magic, hidden API or endless reading of documents. Every unit of code does one and only one thing.</p></pre>Yojihito: <pre><p>Will totally help those people that want a little crawler or a small app for their personal use.</p> <p>Hey, let&#39;s start with blinking LEDs, I&#39;m sure that will help me with this web crawler I need for my work.</p></pre>evigtillvaxt: <pre><p>Do you have any references to that research?</p></pre>Kimau: <pre><p>At work, I dropped a quick IM to my teacher friend. She will have the best links for this :)</p></pre>evigtillvaxt: <pre><p>Thank you! I would love to read about it.</p></pre>klaaax: <pre><p>Is the Ruby bashing necessary? </p></pre>dAnjou: <pre><p>Where exactly did OP bash Ruby?</p></pre>klaaax: <pre><p>are you from Angers?</p></pre>dAnjou: <pre><p>No.</p></pre>godownforwhat: <pre><p>All of the companies i have listed have blogs about why they left ruby for go. Splice and parse have great tech blogs on why Ruby is worse for finding bugs and for building clean manageable code. And the only reason i listed that was because it&#39;s the language everyone suggests as a first language and i want to go against that grain and challenge myself to learn something different. Just like learning Ruby would have been when Rails first came out. </p></pre>Yojihito: <pre><p>Ruby was terrible when Rails came out. I tried to learn it but had no interest in web stuff and every forum/blog was Rails here, Rails there, Rails everywhere but no normal Ruby.</p></pre>

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

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