Learning Go with little to no programming experience in C?

xuanbao · · 750 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi, I am a new comp sci major and was looking into Go and was wondering if it would be inadvisable to learn it before learning other &#34;popular&#34; languages? ie. C, C++, Java...</p> <p>Any tips/suggestions are highly appreciated.</p> <hr/>**评论:**<br/><br/>earthboundkid: <pre><p>As long as you know one other language, it should be easy to learn Go, and learning Go will teach you about important concepts like memory layout and pointers. If you know zero other languages, it may be hard to learn Go, just because most (but not all) of the teaching resources assume you know at least one language. </p> <p>College is pretty much the perfect time to learn new languages on a whim. You&#39;ll never regret learning a language. Go for it!</p></pre>sodasOP: <pre><p>Thanks for the advice and kind words. I took some beginner/intermediate Java in Junior College, as well as a beginner C++ course. They were not very rigorous...so I feel like I did not learn a lot from the course (Although I know programming is a lot about devoting free-time and not just for school assignments, which is why I say I have little to no experience).</p> <p>Would you suggest taking the C, C++, or Java route? Apparently Go is C based? From what I read, at least. I hear either three are all good starters but it&#39;s a mixed opinion, just would like to hear yours.</p></pre>intermernet: <pre><p>Not who you&#39;re replying to, but my 2 cents:</p> <p>Taking the C route will introduce you to the real nitty gritty of low level programming (probably including some assembly). Here you will pick up skills related to kernel development, memory management, and all of the pitfalls of memory management. Here be dragons, but awesomely cool dragons!. Very good for understanding how modern computers work, and really getting the most out of them with the risk of multiple esoteric failure cases.</p> <p>Taking the C++ route will introduce you to an insanely complex, and possibly job specific, environment which will allow you to understand how <em>one language</em> can have so many different ways to do <em>everything</em>. Here be dragons, but awesomely instructive, multi-purpose dragons! Very good for application and game development, with the risk of having to re-learn the wheel for every project you work on.</p> <p>Taking the Java route (or C#) route will introduce you into how enterprises (and some game and app devs) mitigate the flaws in C and C++ development, and provide &#34;more understandable&#34; multi-use platforms for development. Here be dragons, but they&#39;re generally dragons in suits that will cost you your job. Very useful for almost everything, but with costs of verbosity, complexity, and platform specificity. (This is changing, .NET is open sourcing, and many languages now run on the JVM)</p> <p>The above advice should (of course) be taken with many grains of salt. Each language (and family of languages) has it&#39;s merits and sweet spots. We haven&#39;t even touched on Haskell, F#, Clojure, Scala, Erlang, Elixer etc. etc. They all have uses, and they&#39;re all pretty damn good (except for PHP. It should die in flames... Sorry, I had to work with it today, and I hate it even more.)</p> <p>Go tries to pick a point in the Venn diagram that includes simplicity, performance, ease of use, and general modern functionality. It&#39;s also syntactically very close to C and Pascal, but simpler. I absolutely love it for the vast majority of stuff that I&#39;m currently doing, but I don&#39;t think I&#39;d want to write an OS kernel, embedded real-time driver, or game engine in it right now. This may change over time, but we don&#39;t know yet.</p> <p>Overall, I think it&#39;s worth learning Go due to it&#39;s fresh take on concurrency, object-orientation (or-not), and it&#39;s fantastically inclusive standard library. Once you stop trying to write Go like you write other languages, you&#39;ll probably quite enjoy it (although this applies to all languages... don&#39;t try writing Haskell like you write Go either!)</p> <p>Sorry for the rant, but I hope it helps!</p></pre>sodasOP: <pre><p>Very helpful and by no means a rant, I really appreciate the detailed reply! I will definitely take into consideration each description you gave of each language. Seems like you know your stuff and adding bits of examples of their uses was a great help. </p> <p>I am looking for the most &#34;broad&#34; language which looks to be C in this case? Learning how the machine works is most crucial to me atm. In the future I&#39;d like to do some type of game development but I really need to get the basics down before that.</p> <p>Again, thanks for the great reply and info!</p></pre>bkeroack: <pre><p>C is a great language for developing an understanding of what the machine is actually doing, without all the conveniences of a more &#34;modern&#34; language. I don&#39;t believe you can truly appreciate or understand higher-level languages until you know the things they are trying to hide from you.</p></pre>sodasOP: <pre><p>Yeah that makes sense, I was thinking the C route myself. I think learning from the ground up, or in this case the machine up, would be best. Thank you</p></pre>dzosz2: <pre><p>I am by no means experienced programmer but I will try to answer anyway.<br/> They&#39;re all great languages in their own way. C has the best speed, but it&#39;s highly improbable you will use it in your job ( depends how technical is your major of course ). C++ requires you to understand a lot before you get productive, thus making first steps in programming very dull. I have not learned Java at all, but I can tell you that it is the most &#39;employable&#39; language when it comes to working in corporations (alongside c#).<br/> If you are doing it for fun choose Go. It is for cool guys and lets you kick off your apps very quick.</p></pre>sodasOP: <pre><p>Yeah a lot of people say Java is a default language to go with since it&#39;s used everywhere(and taught everywhere). I feel like C would give me more information on the machine compared to Java so I was thinking of going with C. Still unsure whether to start with C or go straight to Go...I probably should learn C first though.</p></pre>drvd: <pre><p>I have a (long) history of Basic, Pascal, C, Fortran and Python and did Java work for quite some time in the not so distant past: It was okay, even good. The last 5 years I did basically just Go (sprinkle bash, R, JavaScript). Now I have to do work in Java and I cannot describe how much I hate it after coding in Go. Not the language itself, I do not care much about syntax or semicolons, it&#39;s more the process. You <em>need</em> an IDE, project setup is awful, maven is broken in this legacy system, ant wrapped by gradle does the work, everything is awkward, Javadoc sucks, code feels like a total mess. And I probably am too stupid to see the beauty of Spring.</p> <p>So if you want to do Go: Do it <em>after</em> Java. There is no way back (at least there isn&#39;t for me).</p></pre>earthboundkid: <pre><p>Go is not C-based, but the look of Go is very similar to C, so people sometimes say that Go is a &#34;modernized&#34; C, although technically speaking they are not related.</p> <p>My opinion is to start with Go out of those languages. The modernizations in Go are nice: no mandatory semicolons, easier to understand error messages, syntax is less weird and has fewer traps (like mandatory semicolons and braceless if statements). Learning Go will make it possible for you to learn the other languages more quickly when you get around to it. &#34;Oh, <code>class</code> is just like <code>struct</code> but for Java and blah blah blah…&#34; etc.</p></pre>YaBoyMax: <pre><p>I thought Go was considered a C-like language. Is this not accurate?</p></pre>sodasOP: <pre><p>Ah I guess I used the word incorrectly, was more thinking along the lines of similar to C. Okay, so far it looks like diving straight into Go or C seems the most popular</p></pre>baqarnaqvi: <pre><p>I am new into programming world, i have basic awareness of html css and i am learning javascript. So should i go with go programming after javascript along with php ?</p></pre>earthboundkid: <pre><p>PHP and JS are nice entry points into programming because they give you quick feedback. Be aware though that they have bad reputations with professional programmers because they tend to be conducive to bad habits. As long as you move beyond them someday, they&#39;re great to get your feet wet. </p></pre>naunga: <pre><p>Personally I think you&#39;ll benefit from not having written any C++ or Java. Go isn&#39;t OO (at least not in the way I&#39;ve looked at it for the past 15 years), so you&#39;ll likely have less bad habits to deal with.</p> <p>I feel that Go is a much better choice for a first language than something like Python or Ruby, because it does get you pretty close to the metal. From the standpoint of learning how computers work internally I think C is always the best choice.</p> <p>Allllll that aside: I&#39;d recommend learning any language that interests you, because they&#39;re just tools for your toolbox, and in my view becoming fanatical about the language you use is kind of silly (text editors, however, are a different story all together)</p></pre>sodasOP: <pre><p>Tools of the toolbox, great analogy actually. Just curious what kind of bad habits did you mean when you said I may benefit from not having written C++ or Java?</p></pre>naunga: <pre><p>&#34;Bad&#34; might not have been the best choice of words. Ingrained might have been better.</p> <p>There&#39;s no concept of classes or objects in Go. So folks with a lot of experience with OOP might find it difficult at first (I know I did). </p> <p>It&#39;s a sort of &#34;teaching an old dog new tricks&#34; thing. Easier to learn fresh then having to unlearn first.</p></pre>sodasOP: <pre><p>Ah yeah I get what you mean now. Yeah I can see that transition to be difficult. You&#39;re just chock-full of analogies aren&#39;t you haha makes sense though.</p></pre>naunga: <pre><p>Heh yeah I am indeed full of analogies. I think I was Doctor McCoy in a past life. </p></pre>sodasOP: <pre><p>I have never seen Star Trek but I am going to assume he was a man full of analogies? haha</p></pre>tvmaly: <pre><p>I think Go as a first language is definitely possible if your a cs major. </p> <p>I decided to teach myself Go by building a side project, and it just came down to practicing the syntax.</p> <p>I wrote a short post <a href="http://www.tysonmaly.com/programming/go/learning-golang/" rel="nofollow">learning golang</a> on the resources I found most useful for those getting started in Go. </p></pre>sodasOP: <pre><p>Nice article and it seems like a great place to start. Bookmarked and If I do decide on learning Go before C then I will definitely check it out. Thank you.</p></pre>BraveNewCurrency: <pre><p>I think it&#39;s a great first language. In fact, your first language tends to warp your programming style for a while. Learning Go, then writing in another language would actually help you design better systems.</p></pre>sodasOP: <pre><p>Yeah the differences in programming styles between other programmers are really interesting to look at. Just wondering by better systems did you mean like styles/practices? Or systems as in computer-related systems?</p></pre>BraveNewCurrency: <pre><blockquote> <p>by better systems did you mean like styles/practices? Or systems as in computer-related systems?</p> </blockquote> <p>I&#39;d say it&#39;s hard to dis-entangle. Better computer systems (programs) can only come from using better ideas/algorithms/approaches. Some styles/practices (tabs vs spaces) may not result in better computer systems, but are aiming at better human communication. Other styles/practices (actors) can cut massive amounts of non-essential complexity out of a system. Some styles/practices (object oriented) will actually add computer system overhead, but are useful for their human understanding. (For example, the Linux kernel is written in C, but is very object-oriented in places. That requires an extra pointer indirection all the time, but it&#39;s worth it because it makes the code more understandable.)</p> <p>The <a href="https://en.wikipedia.org/wiki/Linguistic_relativity" rel="nofollow">Sapir–Whorf hypothesis</a> may not be proven in the general case. But it pretty obviously applies to Computer languages. For example, tell a C programmer to write &#34;word count&#34;, and they will probably use a linked-list. Give the same problem to a Perl programmer, and they will <em>always</em> use a Hash (aka Associative Array). That difference will likely make the Perl program faster.</p> <p>If you come from a language with closures, objects, monads, actors, coroutines, pattern matching, Hashes, etc, it will influence how you structure your code, even in languages that <em>don&#39;t</em> have those things.</p></pre>AndyHaskell: <pre><p>Cxx definitely makes learning Go easier, but Go&#39;s syntax/# of keywords is easy to get into your memory, it has a great community, it&#39;s type-safe, and it has a standard library you can do a lot with, so I think Go would be a great first language to learn</p></pre>sodasOP: <pre><p>Cool. Yeah general consensus I&#39;m getting is that it&#39;s a good first language but knowing C, so to understand the machine, would be a lot better.</p></pre>drvd: <pre><p>&#34;[K]nowing C, so to understand the machine&#34; doesn&#39;t work out with today&#39;s machines. C on the machines of the 1970s was a high-level assembler. Todays multi-leveled memory caches, and multicore machines are not very good represented in C. Most languages do not expose machine details (which is good). From this point there is no difference in what you learn about &#34;the machine&#34; from C or from G: Both expose memory and the concept of indirection (pointers, pointers to pointers, ...). C does it in an unsafe way (which is not helpful for learning or understanding).</p> <p>So from a maschine-viewpoint: No need to do C first.</p> <p>(The OS-viewpoint or hypervisor-viewpoint might be different but going from Go to C should be pretty easy IMHO).</p></pre>dhondu_bhikaji_joshi: <pre><p>C. You will understand memory layout and management, stacks, etc. all of which will help you when learning Go. C++ is also an option but it is too complex if you only want a stepping stone to learning Go</p></pre>

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

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