• 开源镜像
  • 开源沙龙
  • 媛宝
  • 猿帅
  • 注册
  • 登录
  • 息壤开源生活方式平台
  • 加入我们

开源日报

  • 开源日报第1034期:《中国开发者路线图 chinese-developer-roadmap》

    23 2 月, 2021

    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《中国开发者路线图 chinese-developer-roadmap》
    今日推荐英文原文:《Is Debugging Hard? Learn How To Make It Easier》
    日报于今日(2月23日)恢复更新。新年快乐。


    今日推荐开源项目:《中国开发者路线图 chinese-developer-roadmap》传送门:项目链接

    推荐理由:该项目以 kamranahmedse 制作的英文版思维导图为参考,制作的符合中国开发环境的 web 开发者路线图,能够让开发者对全景有一个了解,并为前路提供参考和建议。


    今日推荐英文原文:《Is Debugging Hard? Learn How To Make It Easier》作者:Szymon Adamiak

    原文链接:https://medium.com/better-programming/is-debugging-hard-learn-how-to-make-it-easier-68889091f7fd

    推荐理由:代码与想法并不一定重合,调试就是要解决这个问题。

    Is Debugging Hard? Learn How To Make It Easier

    Sometimes our mental models don’t map the code at all

    It was a judgment day. I had been working on a feature for the last month. That afternoon, my team was to present the work to the CEO.

    I felt fairly confident. The day before, a tester reported a few minor bugs — some obvious things to fix during my morning coffee.

    One task was to show the companies’ logos in a table. Fair enough. But it was weird. I felt like I had fixed it earlier. I even wondered how I could mess up simple logic.

    Well, the only one who doesn’t make mistakes is the one who does nothing. I removed one exclamation mark in the code and believed the job to be done.

    It wasn’t.

    One-and-a-half hours later, I had touched 14 files and changed 250 code lines. I prayed for the fix to work.

    Debugging Is Hard

    When we started to create computer programs, we instantly noticed we were messing it up all the time. To make it worse, it wasn’t easy to fix our mistakes. As Brian Kernighan put it:

    “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”

    So why is debugging so hard? It all comes down to the complexity.

    Even the simplest apps are built on a huge code foundation. Modern developers get many tools for free — tools they don’t really understand. We’re able to use them, but we don’t know how they work.

    Complexity hits us hard, especially when we get a sloppy error message or a complicated stack trace to untangle. Often, the space in the code between the error and its symptoms is huge.

    Our systems are complex, but our inputs can also cause trouble. You’ll often encounter a situation where the end-user has some bug, but you can’t see it on your machine. The bug may be configuration-related or depend on the browser version or sequence of events. Some bugs work in teams and blur the picture even more.

    Also, one error can create various bugs. To make matters worse, fixing a mistake can often produce new ones. It usually indicates a lack of tests or sloppy fixes implemented without understanding the code.

    How To Debug Better

    We all acknowledge that debugging is hard, but how can we make it easier?

    Finding the bug

    To learn debugging, we need to understand one thing: It’s not about adding or deleting the code or logging everything. The essential part of debugging has nothing to do with typing. It has everything to do with thinking.

    Before you begin any debugging, you need to think and analyze your code. What do you think went wrong? Whatever the bug may be, after just a few minutes of deep thinking, you should have a hypothesis. Maybe even a few.

    What’s the next step?

    Test your hypotheses starting from the most probable one. Testing may consist of changing the inputs (e.g. different file size or format to the upload), using a different browser, or commenting out code parts you consider OK. The goal is to narrow down the bug as much as possible.

    Now you should be fairly confident about the bug’s location. If you’re not, there’s an additional technique that can help you: Divide and conquer.

    I wrote an article on that technique, but its essence is simple. You cut your code base in half and use logs to check if the bug is in the first or the second half. Now cut the buggy part in half again. Repeat the process until you narrow down the bug to just a few code lines.

    Fixing the bug

    You’ve found the bug. Now it’s time to fix it. Resist the urge to get coding immediately. As always with debugging, thinking is more important than doing.

    Do you understand the inputs and outputs and the app’s flow? To really know why the error happened, you have to adjust your mental model of the code to reality.

    Sometimes a quick fix is possible, but maybe you don’t fully understand what’s happening. Find out all the cases where the code fails. Try testing it with random inputs. Does it behave as expected?

    After the fix, try all of the cases (both successful and unsuccessful) again. Do you get it now? If you fixed the problem and still are not sure what failed, your job is not done. Tinker around until you fully understand what is happening and when. Otherwise, you’ll stumble on that bug again — maybe in a different place — and you still won’t know what’s going on.

    Conclusion

    You may be wondering, “Did the fix work?” Yes! I managed to make it work and the presentation went fine.

    A misunderstanding of the inputs caused my bug. I worked on massive objects returned from the database and had the wrong perception of some properties. The bug seemed like a simple error in boolean logic, but it was a huge misunderstanding of the system.

    The incident reminded me to not take anything for granted. Programming is hard. Debugging is hard. Sometimes seemingly simple bugs can help you discover a major flaw in your mental model. Learn from it.

    Do you have some debugging failures? Feel free to share in the comments!


    下载开源日报APP:https://opensourcedaily.org/2579/
    加入我们:https://opensourcedaily.org/about/join/
    关注我们:https://opensourcedaily.org/about/love/

  • 开源日报第1033期:《过年 year》

    9 2 月, 2021
    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《过年 year》
    今日推荐英文原文:《Why I Declined an Offer To Work at a Big Tech Company》
    过年了,所以日报休息到 2 月 18 号,下一期将在 19 号恢复更新,预祝各位过个好年。
    今日推荐开源项目:《过年 year》传送门:项目链接
    推荐理由:这个项目的技术含量极高,提供了一个非常有用的服务,可以让你得到对于应用来说非常有用的当前年份数据,除此之外还能方便的获取上一年和下一年的年份数据。看到这里你可能认为我是在耍你,但是实际上……就是这样,可别把没啥用的服务加到真正的应用里去。
    今日推荐英文原文:《Why I Declined an Offer To Work at a Big Tech Company》作者:Jessica Lim
    原文链接:https://medium.com/better-programming/why-i-declined-an-offer-to-work-at-a-big-tech-company-21ee3177b38
    推荐理由:有时选择工作并不需要因为大厂而选择大厂,这个世界除了大厂以外还有很多东西

    Why I Declined an Offer To Work at a Big Tech Company

    I was tired of being another sheep in the toxic world of tech

    In the tech world, the path to success is clear: Secure a software engineering job at Google, Apple, Microsoft, Amazon, or Facebook. If you have a FAANG internship, then you’ve made it in the tech world. If you don’t have one… well, that’s obviously your ultimate goal, so keep grinding out that LeetCode and maybe you’ll make it someday.

    Having a big-tech job on your resume or LinkedIn is like a shiny gold pass with even shinier golden shackles. If Google thinks you’re good enough for them, any humble startup should be groveling at your feet for your services. However, your peers will be dismayed if you “downgrade” from the privilege of working at a big tech company. Like I said before, gold pass. But even shinier golden shackles.

    The world of tech is an impressive system that produces a herd of very excellent sheep. After all, despite the fact that the same type of software job can be found at hundreds of companies, everyone wants that same coveted software job at the same handful of places.

    I didn’t grow up with Silicon Valley in my dreams. In fact, I didn’t know what coding was until a few years back. But the moment I was introduced to the world of tech, it was like I fell into a herd that was all running towards the same pile of food.

    Everyone had the same single-minded goal: Get hired at a tech giant. The message was clear: If you get in, you’ll be wealthy, healthy, and wise. Your world will be golden.

    The industry-wide obsession is so loud that it drowns out the voices of anyone with differing dreams. All you hear is “Google,” “Apple,” and “Facebook,” and the constant propaganda makes you feel as if you won’t amount to anything if you don’t achieve those goals.

    Of course, some “rebel” against the system. Some students leave big tech to chase the money in Wall Street FinTech. They do quant work at Citadel or Jane Street. They “sell their souls” by trading their love of innovative technology for the big bucks in the business world.

    I’m inclined to say that throwing every tech overachiever into the same five corporate social media conglomerates isn’t doing much for worldwide innovation either.

    Let me make something clear: If you’re in it for the money, then go for it. Being a software developer at a big tech company brings in a ludicrous salary, and financial wealth might be your ultimate goal. And you know what? If that’s what you want, more power to you.

    As much as I’d like to wish we lived in an idealistic world, I am not naive enough to think that everyone has the privilege to pursue whatever they want. The stark reality is that living is expensive. Sometimes you just need the financial security of a roof over your head and food on the table.

    Furthermore, sometimes your career isn’t about your dreams. I think we live in a world where self-worth and happiness are too focused on career. Sometimes, a job is simply… a job. Your job does not need to define who you are. For some people, work is where you make money so that you can enjoy the other parts of your life. And that’s great.

    But I know so many people who go into software or technology with dreams of changing the world of tomorrow. They dream of innovating and building the next big thing.

    Then they get sucked into the obsessive world of getting hired by big tech companies. They put the blinders on.

    And it becomes so hard to get out.

    Two months into my second year of university, I got a summer internship offer from Microsoft. People acted like I was a god. I’m not. They assumed I was a coding genius. Again, I’m not.

    They figured I was ready to hit cruise control to the luxurious dream life. “You can probably leverage that into Google or Facebook next year,” one of my peers said while congratulating me.

    He immediately assumed that my goal was to work at Google. Who could blame him? After all, I was a high-achieving software engineering student. What else could I possibly want?

    Maybe I’d like to make my own decisions for a change instead of letting the world make them for me.

    I’m not trying to rip on Microsoft. In fact, I really enjoyed my experience. Everyone was really nice and exceptionally smart. Full-time employees — including VPs and program directors — would happily hop on to virtual coffee chats with me, the lowly intern. I vividly remember a product manager making time in her schedule on a single day’s notice because someone suggested I chat with her in my last week.

    The people at Microsoft were amazing. They were inspiring, encouraging, and made me believe that I could do anything I wanted. They convinced me to dream big, to make mistakes.

    Essentially, they gave me the courage to throw away my safety net and try something else.

    Rejecting my Microsoft return offer was one of the most terrifying things I have ever done. I turned my back on a lot of money, a fancy title, and a resume boost… all for nothing. There was no other job offer to fall back on. All I had was hope and blind faith.

    I realize it was a privilege to take such a risk, but it is also a privilege to go to school and have a job.

    Make no mistake, a choice in your career path is a privilege. But choosing a less luxurious career path is not irresponsible or a waste.

    I think we have a misconception today that turning down a high-status job is an abuse of privilege — that it is equivalent to throwing away all your potential. This mindset is silly and the reason why elite students all gravitate towards the same handful of high-class, high-paying jobs.

    A lower salary doesn’t mean you’re doing less for the world. It also doesn’t mean you’re failing to live up to your potential. Statistically, teachers make less than investment bankers. Social workers make less than software developers. But they are at least as — if not more — important to the wellbeing of society.

    It might be a privilege to be able to choose where you work, but don’t let anyone guilt you into certain decisions.

    You might get a pay cut if you take a leap of faith and follow the path to a less luxurious job, but success is not defined by your paycheck.

    Tony Gaskins Jr. once said:
    “If you don’t build your own dream, someone else will hire you to help build theirs.”
    Maybe your dreams don’t revolve around your tech career. Maybe they lie around your family or your other hobbies.

    But if you’re dreaming about building tech that goes outside the box, maybe loosen the leash that has you collared to the financial security and status of a job in big tech. It doesn’t have to be about quitting your job. It doesn’t have to involve turning away from the path you are on.

    You just need to take off those blinders. There is a world out there that does not revolve around Google, Facebook, and Amazon. And you’re selling yourself short if you don’t at least take a look once in a while.
    下载开源日报APP:https://opensourcedaily.org/2579/
    加入我们:https://opensourcedaily.org/about/join/
    关注我们:https://opensourcedaily.org/about/love/
  • 开源日报第1032期:《个人数据 InfoSpider》

    8 2 月, 2021
    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《个人数据 InfoSpider》
    今日推荐英文原文:《Simplicity and Complexity Needn’t Be Mutually Exclusive In Your Code》

    今日推荐开源项目:《个人数据 InfoSpider》传送门:项目链接
    推荐理由:打开 A 应用的时候,经常会被推送符合自己喜好的 B 应用的广告。我们的足迹和信息分布在各个网站中并被记录,那为何不将它们收集起来为自己所用呢?这就是该项目的功能,旨在安全快捷的帮助用户拿回自己的数据。
    今日推荐英文原文:《Simplicity and Complexity Needn’t Be Mutually Exclusive In Your Code》作者:Nick Hodges
    原文链接:https://medium.com/better-programming/simplicity-and-complexity-neednt-be-mutually-exclusive-in-your-code-cb07154f77db
    推荐理由:单一职责原则(SRP)又称单一功能原则,是面向对象五个基本原则(SOLID)之一,它规定一个类应该只有一个发生变化的原因。本文详细阐释了这一原则,一个螺丝钉的功能应当足够简单。

    Simplicity and Complexity Needn’t Be Mutually Exclusive In Your Code

    Your code is only as complex as you make it

    Good Advice

    The number one piece of advice I would give to a new software developer is this: “Code against abstractions, not implementations.”

    But a close second would be to follow the Single Responsibility Principle.

    The Single Responsibility Principle (SRP) is the first of the five SOLID principles of object-oriented programming. It is also probably the most important one. By following it, you can avoid all kinds of mischief, grief, and trouble.

    Single Responsibility Principle

    The SRP is officially stated as follows:

    A class should have only one reason to change.
    Now, I’m very unsatisfied with this definition. A class can have all kinds of reasons to change — you might find a better implementation, you might fix a bug, you might even decide that it needs an additional parameter or dependency. These are all good reasons for a class to change.

    But what a class should not do is try to do more than one thing. It should have, well, a single responsibility and not take on any more responsibilities.

    Thunderstruck

    I remember sitting at my desk at work one day and being struck by the utter profundity of this notion:

    So much complexity in software comes from trying to make one thing do two things. — Ryan Singer
    This quote hit me like a ton of bricks. It’s so true it made my brain hurt.

    We’ve all been there — you run across some WidgetManager or SprocketEngine class that does fourteen different things. It all starts when someone decides to add another responsibility to a class. Pretty soon that class becomes a magnet for functionality and before you know it, it’s doing everything and it becomes a God Class.

    For the love of Sweet Baby Elvis, don’t do that! Build a new class for the new responsibility.

    The beauty of Singer’s words made me think about what complexity is and what simplicity is. I realized that if you don’t want to build a complex system, don’t create any individual thing that’s complex.

    A Watch

    In one way, a watch is a complex system, but in another way it is not. It consists of individual pieces that are, in themselves, simple: A gear is a simple thing that has one responsibility, same as the Bezel, and the band, and the second hand. Each part is simple.

    The complexity, such as it is, exists because the simple parts interact to provide some amazing functionality. Gears turn the hands, the mainspring pushes a single gear which turns other gears, and so on. Each component interacts with just a few other components to create a powerful system. Yet because of the basic interfaces between parts, there is a simplicity to the whole mechanism.

    The same can be true of our software. All meaningful or useful software will be complex in function. However, it need not be made up of complex things. Just as a watch can be broken down into its component parts, with each part serving a single purpose, so should your software be made up of the interaction of simple classes.

    You should be able to break your software down into individual classes that in and of themselves are not complex. Each class should do a single thing. It is only by interacting with other classes through dependency injection and clean, separated interfaces should complexity appear.

    Complexity in our actual code comes, as Singer notes, when the bindings between classes become so tight that any given class is doing too much. Imagine having a pendulum in a grandfather clock that not only swings back and forth to drive the entire engine, but that also is responsible for spinning that little moon phase indicator around. One can’t even conceive of the machinations that would require, but we do this kind of thing in software all the time.

    So listen to Ryan Singer. Let the stark profundity of his words wash over you, and never let a class do more than one thing.


    下载开源日报APP:https://opensourcedaily.org/2579/
    加入我们:https://opensourcedaily.org/about/join/
    关注我们:https://opensourcedaily.org/about/love/
  • 开源日报第1031期:《git-tips》

    7 2 月, 2021
    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《git-tips》
    今日推荐英文原文:《Microsoft to wipe out old Edge browser with Windows 10 security update》

    今日推荐开源项目:《git-tips》传送门:项目链接
    推荐理由:Git 是一个 “分布式版本管理工具”,简单的理解版本管理工具:大家在写东西的时候都用过 “回撤” 这个功能,但是回撤只能回撤几步,假如想要找回我三天之前的修改,光用 “回撤” 是找不回来的。而 “版本管理工具” 能记录每次的修改,只要提交到版本仓库,你就可以找到之前任何时刻的状态(文本状态)。本项目列举了常用的 Git 命令和一些小技巧。
    今日推荐英文原文:《Microsoft to wipe out old Edge browser with Windows 10 security update》作者:Stephen Shankland
    原文链接:https://www.cnet.com/news/microsoft-to-wipe-out-old-edge-browser-with-windows-10-security-update/
    推荐理由:最近,微软开发的Edge浏览器逐渐扩大对浏览器的市场的占有。Edge浏览器的前身IE浏览器已经被微软丢入历史的垃圾堆,之前的Edge Legacy版本也将被微软彻底抛弃。在windows更新中,Edge Legacy会被移除电脑,新版Edge浏览器将会是windows10的默认浏览器。

    Microsoft to wipe out old Edge browser with Windows 10 security update

    Microsoft will yank its old Edge browser out of Windows 10 PCs on April 13, an important step in its yearslong effort to move its immense customer base to a modern browser.

    Two decades ago, the software giant’s Internet Explorer crushed competitors like Netscape Navigator and dominated the market, but Microsoft let the software languish. Newer rivals like Firefox and Chrome seized the initiative, and Apple’s Safari began a revolution in mobile browsers. Microsoft couldn’t keep up, even after trying to strip IE down into a modernized Edge, so it moved Edge to Google Chrome’s open-source Chromium foundation. It renamed the earlier Edge as Edge Legacy.

    IE has been a relic for years, but now Edge Legacy also is going on the software scrap heap. On Friday, Microsoft announced that a Windows security update will install the new Edge, if it hasn’t already been installed, and remove Edge Legacy. The new Edge already is the default browser on the latest Windows 10 version.

    Microsoft has dramatically changed its stance on browsers over the years. Where it once saw them as a threat to Windows, a rival software foundation that runs on any device, it’s now embraced browsers. On PCs, they’re the most widely used software, and browser-based apps help Microsoft extend its services beyond Windows.

    Microsoft released the first test version of the new Edge for public testing in April 2019 and released the first stable version in January 2020. The software is similar to Google’s dominant Chrome, relying on its core software, but includes differences like a vertical tab arrangement and collections to house information you gather while on the web.

    It’s also built Edge features like improved search designed to help Microsoft’s sizable population of business users.
    下载开源日报APP:https://opensourcedaily.org/2579/
    加入我们:https://opensourcedaily.org/about/join/
    关注我们:https://opensourcedaily.org/about/love/
←上一页
1 2 3 4 … 262
下一页→

Proudly powered by WordPress