-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
341a8b2
commit 44c1c0d
Showing
22 changed files
with
5,342 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,363 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
|
||
|
||
<title>每日心得 | Ich bin Bob Lytton</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="description" content="2020年7月8日,我到北京字节跳动的飞书团队入职实习做后端开发。在这里开一个文档来记录一下实习过程中的心得体会。这里的内容主要是实习过程中的一些随笔札记,所以记得比较细碎,也不会有什么文章结构。此外因为有些内容涉及公司内部信息,所以并不会放到自己的博客上来。看起来就像是隔了好几天没有记东西一样。欢迎感兴趣的人共同交流。 如果有想法,可以在博客的留言区(如果有的话)留言,或者直接去github的r"> | ||
<meta property="og:type" content="article"> | ||
<meta property="og:title" content="每日心得"> | ||
<meta property="og:url" content="http://bob-lytton.github.io/2020/08/02/intern-daily/index.html"> | ||
<meta property="og:site_name" content="Ich bin Bob Lytton"> | ||
<meta property="og:description" content="2020年7月8日,我到北京字节跳动的飞书团队入职实习做后端开发。在这里开一个文档来记录一下实习过程中的心得体会。这里的内容主要是实习过程中的一些随笔札记,所以记得比较细碎,也不会有什么文章结构。此外因为有些内容涉及公司内部信息,所以并不会放到自己的博客上来。看起来就像是隔了好几天没有记东西一样。欢迎感兴趣的人共同交流。 如果有想法,可以在博客的留言区(如果有的话)留言,或者直接去github的r"> | ||
<meta property="og:locale" content="zh_CN"> | ||
<meta property="article:published_time" content="2020-08-02T08:13:20.000Z"> | ||
<meta property="article:modified_time" content="2024-02-11T09:50:01.594Z"> | ||
<meta property="article:author" content="Bob Lytton"> | ||
<meta property="article:tag" content="Bytedance"> | ||
<meta name="twitter:card" content="summary"> | ||
|
||
<link rel="alternate" href="/atom.xml" title="Ich bin Bob Lytton" type="application/atom+xml"> | ||
|
||
|
||
<link rel="shortcut icon" href="/favicon.png"> | ||
|
||
|
||
|
||
<link rel="stylesheet" href="/css/style.css"> | ||
|
||
|
||
|
||
<link rel="stylesheet" href="/fancybox/jquery.fancybox.min.css"> | ||
|
||
|
||
|
||
<meta name="generator" content="Hexo 7.1.1"></head> | ||
|
||
<body> | ||
<div id="container"> | ||
<div id="wrap"> | ||
<header id="header"> | ||
<div id="banner"></div> | ||
<div id="header-outer" class="outer"> | ||
<div id="header-title" class="inner"> | ||
<h1 id="logo-wrap"> | ||
<a href="/" id="logo">Ich bin Bob Lytton</a> | ||
</h1> | ||
|
||
<h2 id="subtitle-wrap"> | ||
<a href="/" id="subtitle">Willkommen</a> | ||
</h2> | ||
|
||
</div> | ||
<div id="header-inner" class="inner"> | ||
<nav id="main-nav"> | ||
<a id="main-nav-toggle" class="nav-icon"><span class="fa fa-bars"></span></a> | ||
|
||
<a class="main-nav-link" href="/">Home</a> | ||
|
||
<a class="main-nav-link" href="/archives">Archives</a> | ||
|
||
</nav> | ||
<nav id="sub-nav"> | ||
|
||
|
||
<a class="nav-icon" href="/atom.xml" title="RSS 订阅"><span class="fa fa-rss"></span></a> | ||
|
||
<a class="nav-icon nav-search-btn" title="搜索"><span class="fa fa-search"></span></a> | ||
</nav> | ||
<div id="search-form-wrap"> | ||
<form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="搜索"><button type="submit" class="search-form-submit"></button><input type="hidden" name="sitesearch" value="http://bob-lytton.github.io"></form> | ||
</div> | ||
</div> | ||
</div> | ||
</header> | ||
|
||
<div class="outer"> | ||
<section id="main"><article id="post-intern-daily" class="h-entry article article-type-post" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting"> | ||
<div class="article-meta"> | ||
<a href="/2020/08/02/intern-daily/" class="article-date"> | ||
<time class="dt-published" datetime="2020-08-02T08:13:20.000Z" itemprop="datePublished">2020-08-02</time> | ||
</a> | ||
|
||
<div class="article-category"> | ||
<a class="article-category-link" href="/categories/Intern/">Intern</a> | ||
</div> | ||
|
||
</div> | ||
<div class="article-inner"> | ||
|
||
|
||
<header class="article-header"> | ||
|
||
|
||
<h1 class="p-name article-title" itemprop="headline name"> | ||
每日心得 | ||
</h1> | ||
|
||
|
||
</header> | ||
|
||
<div class="e-content article-entry" itemprop="articleBody"> | ||
|
||
<p>2020年7月8日,我到北京字节跳动的飞书团队入职实习做后端开发。在这里开一个文档来记录一下实习过程中的心得体会。<br>这里的内容主要是实习过程中的一些随笔札记,所以记得比较细碎,也不会有什么文章结构。此外因为有些内容涉及公司内部信息,所以并不会放到自己的博客上来。看起来就像是隔了好几天没有记东西一样。<br>欢迎感兴趣的人共同交流。</p> | ||
<p>如果有想法,可以在博客的留言区(如果有的话)留言,或者直接去github的repo上提issue。</p> | ||
<span id="more"></span> | ||
|
||
<h2 id="20-7-21"><a href="#20-7-21" class="headerlink" title="20/7/21"></a>20/7/21</h2><ul> | ||
<li>有API的尽量用API,不要自己实现<ul> | ||
<li>当然用API的时候也要看清楚API适用的场景,这可能和API内部实现方法有关</li> | ||
<li>例子:在使用golang给url添加query的时候,建议使用net/url包内的方法,而不要自己手动<code>fmt.Sprintf("%s?xx=%s", path, queryValue)</code>这样,因为这里的<code>queryValue</code>需要进行<code>url.QueryEscape</code>处理,而url包内的方法包含了这一处理过程。</li> | ||
<li>这里蕴含了标准化操作流程的思想,可以减少bug的产生</li> | ||
</ul> | ||
</li> | ||
<li>serverless概念:<ul> | ||
<li>serverless不是no server,只是用户注意力不在server上</li> | ||
<li>serverless = FaaS + BaaS</li> | ||
<li>FaaS:Function as a Service(函数服务)</li> | ||
<li>BaaS:Backend as a Service</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
<h2 id="20-7-22"><a href="#20-7-22" class="headerlink" title="20/7/22"></a>20/7/22</h2><ul> | ||
<li>三机房部署<ul> | ||
<li>在三个互相联网的机房部署一个服务,可以在一个机房宕机或者一条链路断开时仍然维持正常服务。比双机房稳定性更强</li> | ||
</ul> | ||
</li> | ||
<li>开发-发布模式:<ul> | ||
<li>分支开发-分支发布</li> | ||
<li>主干开发-分支发布</li> | ||
<li>分支开发-主干发布</li> | ||
<li>主干开发-主干发布</li> | ||
<li>全主干开发(Trunk Based Development):在remote端不维护分支。这种模式假设提交者提交的代码都是bug-free的,是对开发者的乐观预期。</li> | ||
</ul> | ||
</li> | ||
<li>微服务</li> | ||
<li>二方包</li> | ||
<li>go的包import是直接引用源码</li> | ||
<li><a target="_blank" rel="noopener" href="https://try.redis.io/">Redis Tutorial</a>学习感想:<ul> | ||
<li>先学会有哪些操作,然后去了解自己操作的是什么,然后去更深入地了解redis的内部架构</li> | ||
</ul> | ||
</li> | ||
<li>Exception的处理:<ul> | ||
<li>要分析出异常的可能原因,哪些原因下抛出的异常需要服务继续work,哪些是fatal必须要停止服务<ul> | ||
<li>遭受攻击</li> | ||
<li>服务器内部出错</li> | ||
<li>代码bug</li> | ||
<li>其他问题?</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
<h2 id="20-7-23"><a href="#20-7-23" class="headerlink" title="20/7/23"></a>20/7/23</h2><ul> | ||
<li>go语言新初始化一个error的方法:<ul> | ||
<li><code>errors.New()</code></li> | ||
<li><code>fmt.Errorf()</code></li> | ||
<li><code>logrus.Errorf()</code></li> | ||
<li><code>logrus.WithError(err).Errorf()</code>,其中<code>func (l *Logger) WithError(err error)</code>在logger的一条entry里添加了<code>error</code>的字段</li> | ||
</ul> | ||
</li> | ||
<li>关于代码调试,找到一篇不错的blog:<a target="_blank" rel="noopener" href="https://blog.codingnow.com/2018/05/ineffective_debugger.html">https://blog.codingnow.com/2018/05/ineffective_debugger.html</a></li> | ||
<li>git pull和git pull rebase</li> | ||
</ul> | ||
<h2 id="20-7-26"><a href="#20-7-26" class="headerlink" title="20/7/26"></a>20/7/26</h2><ul> | ||
<li>k8s:kubernetes的简写,一种开源的集群管理系统</li> | ||
<li>debug的感想:<ul> | ||
<li>多打log<ul> | ||
<li>leader有一次说过:当你负责某个oncall,而某天半夜被叫起来处理问题的时候,你没办法找其他任何人,但你又要把问题解决。同情一下那个时候的你,现在就多打点log吧</li> | ||
<li>当然log打太多了也有副作用:占用存储太大。有同事在前公司遇到过打log把服务器打爆的情况</li> | ||
</ul> | ||
</li> | ||
<li>对bug有猜想一定要通过log或者复现来证实它</li> | ||
</ul> | ||
</li> | ||
<li>开发复杂的程序,一定要先有清晰的架构,并整理成文档<ul> | ||
<li>所以我经常看见有同事画功能分层</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
<h2 id="20-7-27"><a href="#20-7-27" class="headerlink" title="20/7/27"></a>20/7/27</h2><ul> | ||
<li>提出需求后要进行需求的拆解,接口也要讨论清楚</li> | ||
<li>搞清楚应用的场景,以及自己要做什么</li> | ||
<li>不能完全依赖运行代码来debug,有时候代码上线非常慢,如果最后只是因为一个个小错误就要不断地重新上线是非常浪费时间的。所以要养成良好的代码习惯,写代码的时候要时刻清醒自己在写什么,不能在熟悉的地方全凭肌肉记忆,复制粘贴的代码一定要仔细检查。</li> | ||
<li>ssh进入bash终端后自动执行的是.bash_profile,要想执行.bashrc就要在.bash_profile里面调用</li> | ||
<li>别人的代码是个很好的学习途径。(又叫最佳实践,团队里最好收集整理一下)</li> | ||
</ul> | ||
<h2 id="20-7-28"><a href="#20-7-28" class="headerlink" title="20/7/28"></a>20/7/28</h2><ul> | ||
<li>环境变量在容器里很重要</li> | ||
<li>代码上线后,测试的时候要弄清楚自己测的是不是新版的代码</li> | ||
</ul> | ||
<h2 id="20-7-29"><a href="#20-7-29" class="headerlink" title="20/7/29"></a>20/7/29</h2><ul> | ||
<li>技术债:不良的代码习惯导致的可维护性差的代码段,这种代码在开发中写起来比较简便,上线快,但是后期会成为很大的累赘,就像债务一样,越欠越多,是个隐患。</li> | ||
<li>Web编程里重要的调试手段就是直接看web请求抓包,因为API就是web请求本身</li> | ||
<li>go的单元测试:<ul> | ||
<li>写法:在同一个包的路径下,写一个<code>*_test.go</code>文件</li> | ||
<li>用法:在包路径下,运行<code>go test</code>即可,可通过<code>go help test</code>查看更多用法。</li> | ||
</ul> | ||
</li> | ||
<li>Web session和Cookie的概念</li> | ||
</ul> | ||
<h2 id="20-7-30"><a href="#20-7-30" class="headerlink" title="20/7/30"></a>20/7/30</h2><ul> | ||
<li>Cookie的SameSite属性</li> | ||
<li>二分查找不能查找无序序列<ul> | ||
<li>这样说起来似乎很trivial,但是当二分查找被写进API的时候就要注意</li> | ||
<li>例子:go语言的<code>sort.Search()</code>就是一个二分查找,使用前要注意被查找的数组是否有序</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
<h2 id="20-7-31"><a href="#20-7-31" class="headerlink" title="20/7/31"></a>20/7/31</h2><ul> | ||
<li>Hook的定义</li> | ||
<li>为解决问题而查阅资料时,最好先脑内推理一下,有一个对solution的猜想,然后沿着这个猜想的思路去找证据(被mentor教做人了)</li> | ||
<li>上下文:用来查找调用链,比较适合高并发的场景。一个方法要带context参数调用下游方法时,这个context参数应当来自它的上游方法,由此则形成了一条链。</li> | ||
</ul> | ||
<h2 id="20-8-3"><a href="#20-8-3" class="headerlink" title="20/8/3"></a>20/8/3</h2><ul> | ||
<li>实习怎么才能长进?<ul> | ||
<li>除了熟悉业务流程,还要在上班时间之外去学习深究遇到的新东西,只是这确实很累啊</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
|
||
|
||
</div> | ||
<footer class="article-footer"> | ||
<a data-url="http://bob-lytton.github.io/2020/08/02/intern-daily/" data-id="clshbr7a200098z936mqd97io" data-title="每日心得" class="article-share-link"><span class="fa fa-share">分享</span></a> | ||
|
||
|
||
|
||
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Bytedance/" rel="tag">Bytedance</a></li></ul> | ||
|
||
</footer> | ||
</div> | ||
|
||
|
||
<nav id="article-nav"> | ||
|
||
<a href="/2020/08/02/golang-fundamental/" id="article-nav-newer" class="article-nav-link-wrap"> | ||
<strong class="article-nav-caption">前一篇</strong> | ||
<div class="article-nav-title"> | ||
|
||
Go语言入门 | ||
|
||
</div> | ||
</a> | ||
|
||
|
||
</nav> | ||
|
||
|
||
</article> | ||
|
||
|
||
</section> | ||
|
||
<aside id="sidebar"> | ||
|
||
|
||
<div class="widget-wrap"> | ||
<h3 class="widget-title">分类</h3> | ||
<div class="widget"> | ||
<ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Golang/">Golang</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/Intern/">Intern</a></li></ul> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
|
||
<div class="widget-wrap"> | ||
<h3 class="widget-title">标签</h3> | ||
<div class="widget"> | ||
<ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Bytedance/" rel="tag">Bytedance</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Coding/" rel="tag">Coding</a></li></ul> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
|
||
<div class="widget-wrap"> | ||
<h3 class="widget-title">标签云</h3> | ||
<div class="widget tagcloud"> | ||
<a href="/tags/Bytedance/" style="font-size: 10px;">Bytedance</a> <a href="/tags/Coding/" style="font-size: 10px;">Coding</a> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
<div class="widget-wrap"> | ||
<h3 class="widget-title">归档</h3> | ||
<div class="widget"> | ||
<ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2024/02/">二月 2024</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/08/">八月 2020</a></li></ul> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
|
||
<div class="widget-wrap"> | ||
<h3 class="widget-title">最新文章</h3> | ||
<div class="widget"> | ||
<ul> | ||
|
||
<li> | ||
<a href="/2024/02/11/hello-world/">Hello World</a> | ||
</li> | ||
|
||
<li> | ||
<a href="/2020/08/02/golang-fundamental/">Go语言入门</a> | ||
</li> | ||
|
||
<li> | ||
<a href="/2020/08/02/intern-daily/">每日心得</a> | ||
</li> | ||
|
||
</ul> | ||
</div> | ||
</div> | ||
|
||
|
||
</aside> | ||
|
||
</div> | ||
<footer id="footer"> | ||
|
||
<div class="outer"> | ||
<div id="footer-info" class="inner"> | ||
|
||
© 2024 Bob Lytton<br> | ||
Powered by <a href="https://hexo.io/" target="_blank">Hexo</a> | ||
</div> | ||
</div> | ||
</footer> | ||
|
||
</div> | ||
<nav id="mobile-nav"> | ||
|
||
<a href="/" class="mobile-nav-link">Home</a> | ||
|
||
<a href="/archives" class="mobile-nav-link">Archives</a> | ||
|
||
</nav> | ||
|
||
|
||
|
||
<script src="/js/jquery-3.6.4.min.js"></script> | ||
|
||
|
||
|
||
|
||
<script src="/fancybox/jquery.fancybox.min.js"></script> | ||
|
||
|
||
|
||
|
||
<script src="/js/script.js"></script> | ||
|
||
|
||
|
||
|
||
|
||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.