I'd like to use Go for a web app, but my partner only knows python. Is there a way we can both get what we want?

blov · · 592 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>tl;dr: Is it <strong><em>plausible</em></strong> for me and a partner to develop a web app in pyhton and Go?</p> <p>I mostly take care of the models and views while he does the logic and data analysis/visualization. Our aim is to build a production dashboard with a small collection our charts and raw data tables. I&#39;m fairly new to Go(~1 month of messing around), but not programming. I have a couple years experience with C#, and ~6 months of python.</p> <p>As far as I can tell, the standard libraries for web dev amount to something reminiscent to python-flask, and the templates aren&#39;t too foreign either. This is partly a learning experience for me, and I feel like I have nothing to learn by making another simple flask app that only reads data from a database.</p> <p>Is there a fairly easy way I can develop an interface for our database in Go, and give him access via python whether it returns json, xml, or whatever?</p> <p>Edit: I should mention, we&#39;re both on windows, and as much as I&#39;d love to use linux, that isn&#39;t an option for either of us.</p> <hr/>**评论:**<br/><br/>mixedCase_: <pre><p>If he&#39;s experienced with Python he should be able to learn Go in a day and write passable production code within 5 days. Assuming you&#39;re providing some guidance, and yes I&#39;m taking into account you&#39;re not too experienced either.</p> <p>If he doesn&#39;t have the drive to learn you&#39;re wasting your time; go for something both of you understand or cut the team in half: A single page application for the frontend and a JSON API for the backend, no server-side templating with the index as a possible exception.</p> <p>Good luck.</p></pre>watr: <pre><p>If he has Exp. With C/C++ he can write passable production code on day 2. Just read the source code to godoc. After reading that you will know most Golang idioms.</p></pre>kwerkor: <pre><p>Unfortunately he&#39;s not really interested learning anything. I guess I&#39;ll probably just work with python since that would obviously be the easiest solution, and the quickest way to get this done.</p></pre>lachlan_s: <pre><p>Seems like you need a new partner. A programmer who isn&#39;t interested in learning something new isn&#39;t worth the chair they sit in.</p></pre>everdev: <pre><p>Show them this and then code in Go happily together: <a href="https://codeburst.io/why-we-switched-from-python-to-go-60c8fd2cb9a9" rel="nofollow">https://codeburst.io/why-we-switched-from-python-to-go-60c8fd2cb9a9</a></p></pre>brilliantdick: <pre><p>Tell your partner to suck it up and learn it. Go is easy with a day or two of hacking around.</p></pre>redditbanditking: <pre><blockquote> <p>Is there a fairly easy way I can develop an interface for our database in Go, and give him access via python whether it returns json, xml, or whatever?</p> </blockquote> <p>You can build a rest API interface to your database, and have your partner build the backend of the data visualization part. So it looks like this:</p> <p>Frontend -&gt; Python -&gt; Go -&gt; DB</p></pre>kwerkor: <pre><p>So build an api in Go an and use python on top of it? I think that might be the easiest solution.</p></pre>piratelax40: <pre><p>opposite direction. python api that go queries for the data/assets needed to do things. Go and python both can access the db, or you can have go be the only thing that does (eg calls python, both saves to DB + sends to client)</p> <pre><code> DB / | frontend --&gt; go | \ python </code></pre> <p>You can also use the DB as the &#39;source of truth&#39; and have both languages interact with the DB, duplicates effort but can make it easier to isolate pieces. This, imo, can require a more sophisticated architecture to implement well.</p> <p>edit: fuck it cannot get that branching diagram to render properly - but frontend to go, go to db and go to python and theoretically can also easily do python to db as needed</p></pre>kwerkor: <pre><p>Okay I see what you&#39;re saying. That would definitely work. I can just feed him the data from the database, I can pull from the database and I can read his data/visualizations as json/html.</p></pre>kwerkor: <pre><p>Okay I see what you&#39;re saying. That would definitely work. I can just feed him the data from the database, I can pull from the database and I can read his data/visualizations as json/html.</p> <p>So he could get data from the database, do his manipulations, and serve json/html on an API request.</p></pre>zanven42: <pre><p>You could use grpc for connectivity between python and go, and use the protobuf file as your &#34;API contract&#34;. </p> <p>Effectively your making microservices. Personally it&#39;s worth the setup of grpc because I like the strong typing and compile time knowledge that each end is setup correctly, but if it&#39;s a very small app simpler solutions have been suggested by others and may be more well suited. </p></pre>poetic_waffle: <pre><p>I think it depends on the project goals. </p> <p>If it&#39;s something that needs to be done quickly then I think you should both go with Python since you both have more experience.</p> <p>If it&#39;s something that is going to stay in your stack for a very long time and you do not mind spending some time learning on the project then you could use Go. If your partner doesn&#39;t want to learn, you could choose a small or bigger part of the application that is going to be your sole responsibility and write that in Go while he handles the rest in Python.</p> <p>Go is pretty good at making REST APIs but be warned, working with a db in Go can be quite boring.</p></pre>mcandre: <pre><p>Some projects can be split into multiple tiers, where one part of the system is responsible for certain things, and another part responsible for other things. If you can break up the server into a backend server in Go, with a frontend server in Python, that’s one way to regularly separate duties. The backend server manipulates JSON REST calls, the frontend server provides a Web UI, requesting information from time to time from the backend.</p></pre>watr: <pre><p>Why is Linux not an option? I run windows and just do all my coding in a VM. Linux is just so much nicer than windows for coding... I put my VM on a solid state external drive hooked up to my machine via eSATA. Super fast, and I can pull up my coding VM on any machine with VMware Workstation (free). Only draw-back is that I can&#39;t do multi-monitor VM.</p></pre>Kraigius: <pre><p>Have you checked out Eclipse Che? If yes, what are your thoughts about it? It seems similar to what you are doing and I have a friend who mentioned it to me.</p></pre>watr: <pre><p>It&#39;s not similar at all. You&#39;re comparing my fully functional OS with multiple dev tools and IDEs to a single IDE (eclipse) that happens to run through a browser and hosted on a server somewhere, thereby making it accessible from anywhere that server is accessible.</p> <p>I haven&#39;t used Eclipse Che. While i have been a fan of Eclipse as an IDE for Pytuon and C/C++, I haven&#39;t found it to be good for golang. However, I haven&#39;t looked at it for golang in a year, so maybe it&#39;s better now.</p></pre>Kraigius: <pre><p>Well, it&#39;s not really just that. It&#39;s an Dockerize IDE by itself and you basically set up different docker container for the different development environment you need. It is hosted locally but can work remotely, maybe you&#39;re thinking of the codeenvy flavor.</p> <p>From my understand its point is to rid ourselves of VM, make it fast &amp; simple to set new coding environment, makes our entire environment portable, and rid ourselves of the multiple IDEs problem.</p> <p>Since you said you were using VM for coding this seemed like a possible replacement and I&#39;m just asking you if you heard about it and why it can/can&#39;t replace your VM coding environment. You know, I just learned about its existence so I&#39;m just asking around if it can fit your use cases. I&#39;m not comparing anything, I&#39;m asking you to do it :p .</p></pre>watr: <pre><p>Understood. I will have to check it out.</p></pre>

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

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