<p>I have some downtime at work and I can spend my time learning what I want. Go has been on the list for a while and I'd really like to learn it and possibly use it in real projects.</p>
<p>Now, I could make a web backend with an MVC architecture, make some endpoints etc... But that's kinda boring as it would just replace what I already know and can do in Java with Spring.</p>
<p>What's a good project to do in Go to learn it, while utilizing the benefits of the language? Concurrency and such.</p>
<p>I have a Java/Python background in terms of the backend. Id like to build something first in Java, then Go, and compare benchmarking. Something that requires performance and optimization but is also not useless :) </p>
<p>Any good ideas? I was thinking image recognition and then comparing with a lot of pictures already, or something.</p>
<hr/>**评论:**<br/><br/>tangwyn: <pre><p>A former co-worker I knew worked at a place that used the ball clock problem (<a href="http://www.chilton.com/%7Ejimw/ballclk.html" rel="nofollow">http://www.chilton.com/~jimw/ballclk.html</a>) to convert their existing programmers to Go, then used it as the hiring exercise for new applicants to submit, if they were hired they spent the next month optimizing the code which requires learning Go inside and out.</p>
<p>Her observations were:</p>
<p>1) The best people didn't look up examples on GitHub and embraced the learning exercise.</p>
<p>2) The first working version shows what language someone knows. Ex: "Java in Go"</p>
<p>3) Introduce test and benchmarking tools using 123rd ball, it is the longest computation. How much does a variable declaration cost?</p>
<p>4) Learn how to identify bottlenecks in code and start with the worst one first. Loops cause more issues that lines that execute once kind of thing, do you need to complete a loop or can you break out? Apparently the VP would make people read "The Goal" too.</p>
<p>5) Naturally adopt Go koans and learn how to write idiomatic code, which proves out to be the fastest. Departure from "Java in Go"</p>
<p>6) Fastest examples were around a tenth of a second when executing the 123rd ball without using a math cheat to skip a ball operation.</p></pre>PatBotCake: <pre><p>I appreciate The Goal is a valuable book but I could not finish it</p></pre>tangwyn: <pre><p>"The Goal" is just a fictional story illustrating the Theory of Constraints.</p></pre>PatBotCake: <pre><p>Yeah I got the gist of it. It's just the story is terribly written.</p></pre>nwss00: <pre><p>I was forced to read The Goal in a business class.</p>
<p>What does that book have to do with coding?</p></pre>PatBotCake: <pre><p>Coding has nothing to do with business, it exists entirely within a bubble!</p>
<p>The reason you had to read it in Business class is because the Theory of Constraints is universal, the concepts apply to coding and factories. The Phoenix Project was heavily influenced by The Goal.</p></pre>cowens: <pre><p>Huh, I just tried it and the 123 ball clock is taking 32 seconds on my naïve implementation. Guess it is time to learn how to profile Go code. I am betting the problem is either in my cycle detection test (which is really naïve) or my drain function (which isn't much better). I also used channels to represent the tracks. It might be better to use a data structure for them that can do the whole reverse order thing without having to slop them into a slice first.</p></pre>tangwyn: <pre><p>Sounds like you are asking the right questions. Remove everything that isn't necessary. If it is necessary, find the fastest way. That is the whole point. But try not to give away too much publicly :)</p></pre>tonymonmaster: <pre><p>Comment to save for later </p></pre>catbrownie: <pre><p>There's a save button for every reply, please use that instead.</p></pre>gngeorgiev: <pre><p>You can't tell me what to do</p></pre>catbrownie: <pre><p>Wow, Ok. </p></pre>gngeorgiev: <pre><p>I am not even him lol</p></pre>tonymonmaster: <pre><p>Apparently not on my mobile app there isn't :-(</p></pre>justinisrael: <pre><p>I started learning Go after primarily coding in Python. For me, I was never going to really learn Go if I tried to just do arbitrary exercises, trying to just use all the goodies of the language. The way I really learned it was to solve a real problem I had at work. A piece of software written in Python needed a rewrite, so I did it in Go. It didn't require any concurrency or net logic. But it was a great way to solve a real production need as opposed to a contrived project.</p>
<p>Pick something you actually need to solve or rewrite, regardless of whether it exercises all of the Go stdlib. </p></pre>Redundancy_: <pre><p>I always think it's nice to do something that's useful, even if it's a smaller project - doing something that does operation(s) that take a while, but can print out some sort of progress is ideal. I feel like you should start by trying to use errgroup, just since it helps putting in good patterns for cancellation and error handling.</p>
<p>I love using Go to give QA various CLI tools for testing, but I've also used it to build bots for slack that report status of servers etc. and respond to chat commands as mini-projects.</p></pre>Redundancy_: <pre><p><a href="https://www.reddit.com/r/golang/comments/7bcf8l/after_reading_about_go_list_i_made_a_small/" rel="nofollow">https://www.reddit.com/r/golang/comments/7bcf8l/after_reading_about_go_list_i_made_a_small/</a></p>
<p>Here's a potentially useful project that could do with a go rewrite :)</p></pre>everdev: <pre><p>The correct order seems to be:</p>
<ol>
<li>Package that abstracts error handling</li>
<li>ORM</li>
<li>Router</li>
<li>Integrate 1-3 into a web framework</li>
</ol></pre>KevBurnsJr: <pre><p>I recommend doing something with websockets. Maybe a chat client.</p>
<p>Or a slack bot.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传