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

开源日报

  • 开源日报第954期:《Web-Dev-For-Beginners》

    19 11 月, 2020
    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《Web-Dev-For-Beginners》
    今日推荐英文原文:《The Best Engineering Advice I Ever Got: “I Don’t Really Care, Just Make it Work”》

    今日推荐开源项目:《Web-Dev-For-Beginners》传送门:项目链接
    推荐理由:这个项目是微软的 web 开发教程,包含了推荐的视频与文字教程,每一节课程都提供了课前与课后的问题与任务等等,而且教学内容是从编程语言的基础开始介绍的,也可以推荐给没有接触过编程的人,唯一需要的就是英语阅读能力了。
    今日推荐英文原文:《The Best Engineering Advice I Ever Got: “I Don’t Really Care, Just Make it Work”》作者:Zack Shapiro
    原文链接:https://medium.com/better-programming/the-best-engineering-advice-i-ever-got-i-dont-really-care-just-make-it-work-2e238f0cf908
    推荐理由:不是需要学习的时候,就没必要太追求细节什么的了

    The Best Engineering Advice I Ever Got: “I Don’t Really Care, Just Make it Work”

    Stop lettings “shoulds,” academics, and random blog posts stop you and your team from shipping

    I used to work under a very academic tech lead. When he wasn’t re-writing features that had been done for days or weeks to make them more perfect — from a code and file organization perspective — he was reading blog posts about design patterns and how things should be in your codebase.

    It had been three months since the date we were supposed to ship the first version of our app and we still didn’t have anything out. While the other members our of team were busy building and shipping features for v1, he was writing and rewriting, futzing with the file structure, and trying to get everything to be perfect. Eventually our CTO got wind of this as week after week would pass and the app still wasn’t out.

    After the app shipped, our tech lead left the company, and I got promoted into his position. Then something weird happened:

    My initial inclination was to continue the tradition. Not the rewriting, but the perfectionism.

    Not long after, I was building a single sign on feature for our enterprise clients and I started waffling back and forth about the “best” way to write a very small function and where that should live. It was probably 5 lines, max.

    Should it be a free function? Should it be in its own file or co-mingled with the other single sign on code?

    Should it be a class with a single exposed function?

    Since it was so small, could should I just attach it to another part of the single sign on work and not worry about it living on its own?

    His mindset had become mine and I was paralyzed by decisions that had little-to-no real world consequence and made no difference to the people paying our company lots of money.

    I walked over to our VP of Engineering to determine what the best thing was to do with this little function. I was prepared to have a similar discussion with him as I’d had countless times with our previous tech lead,
    v
    v Instead, the conversation was brief. His response, which forever changed how I worked and thought about code was,
    “I don’t really care, just make it work.”
    I felt free.

    I was the tech lead, after all! This was my team!

    We’d all disliked the previous style of academic and blog post-driven perfectionism. Why was I continuing to worry about if our code matched how someone outside of our team said things should be done.

    These trends change over time. Believe me, I’m the Editor of Better Programming ?. The blog post was helpful in theory but ultimately inconsequential to the business.

    We just had to ship.

    It changed how I led the team, from that conversation, onward.

    “Make a note, let’s revisit it after we ship” became my go to line. We all knew what we had to do. We’d build the feature, QA it, fix any bugs, then call it done and move onto the next feature. Somewhere was that list, safely tucked away, things for us to revisit down the road.

    After we shipped, nothing disastrous happened because our code wasn’t perfect.
    The procrastination was fear, disguised. It took that short conversation with my VP to make me realize that.
    It’s absolutely okay to have agreed upon standards in your codebase and best practices for your team and for your company. If your team is moving slower because everyone on the team needs to have their code filtered into the particular style or preferences of a certain, strongly opinionated engineer, it’s going to take you a lot longer to ship everything.

    So whether you’re learning to code and reading this or you’re deeper into your engineering career, spend more time getting things to work and less time obsessing about the shoulds of engineering.

    Makes sure your code is secure, reliable, and relatively efficient. But remember: your code is most likely not (yet) operating at a scale where an inefficiency is going to cost your business significant money. So it doesn’t matter! Just make it work.

    As you scale, you’ll rewrite that code to make it better. Revisit that after you ship.

    It’s far more likely that your code not shipping is going to cost the business more instead.
    下载开源日报APP:https://opensourcedaily.org/2579/
    加入我们:https://opensourcedaily.org/about/join/
    关注我们:https://opensourcedaily.org/about/love/
  • 开源日报第953期:《智能合约 Solidity》

    18 11 月, 2020
    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《智能合约 Solidity》
    今日推荐英文原文:《Nothing’s More Important Than Showing Up》

    今日推荐开源项目:《智能合约 Solidity》传送门:项目链接
    推荐理由:区块链技术已经成为当下的热门话题,但它的诞生却是在十多年前比特币诞生的时候。而 Solidity 则是应运而生的一种高级语言,用于在以太坊虚拟机(EVM)中实现智能合约。区块链的本质是去中心化的数据库,而智能合约则是所有人都能看到的数据或交易。
    今日推荐英文原文:《Nothing’s More Important Than Showing Up》作者:Ross McCammon
    原文链接:https://forge.medium.com/nothings-more-important-than-showing-up-476900bc1fc7
    推荐理由:明天会有我的博客,只是因为它是明天。

    Nothing’s More Important Than Showing Up

    Bestselling author Seth Godin has been writing frequently about creativity on Medium the past few weeks. This week he wrote about the importance of simply showing up. For Godin, creativity isn’t as much inspiration as it is application: arriving on time and doing the work. In a word: practice.

    “When we commit to a practice, we don’t have to wonder if we’re in the mood, if it’s the right moment, if we have a headache or momentum or the muse by our side. We already made those decisions.”

    It was key to his own success, he says: “Twenty years ago, I decided to blog every day. There will be a blog from me tomorrow. Not because it’s the best one I’ve ever written, or perfect, or even because I’m in the right mood. It will be there because it’s tomorrow.”

    I’ve thought a lot about this post as we head into this pandemic winter. How do we face it? How do we continue to do great work? I think Godin has the answer: methodically, regularly. You can find control amid chaos but only if you apply a schedule that gives you space to create. Now, more than ever, structure is a shelter from the storm.


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

    17 11 月, 2020
    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《moment》
    今日推荐英文原文:《Zuckerberg and Dorsey are facing lawmakers again. It won’t be pretty》

    今日推荐开源项目:《moment》传送门:项目链接
    推荐理由:moment是一个专门处理时间日期的库,moment不仅提供基于时区的各种时间展示形式,而且可以对日期进行加减,判断时间点是否在某个时间段内,配合插件系统,moment提供了时间日期的全套解决方案。
    今日推荐英文原文:《Zuckerberg and Dorsey are facing lawmakers again. It won’t be pretty》作者:Queenie Wong
    原文链接:https://www.cnet.com/news/zuckerberg-and-dorsey-are-facing-lawmakers-again-it-wont-be-pretty/
    推荐理由:美国大选尘埃落定, 川宝光荣下岗. 但是, 美国两位科技大佬最近的日子不好过. 共和党人一再指责Facebook和 Twitter存在政治偏见, 两名CEO将再次面对立法者.

    Zuckerberg and Dorsey are facing lawmakers again. It won’t be pretty

    Facebook CEO Mark Zuckerberg and Twitter CEO Jack Dorsey are headed back to the Senate, and though the social media moguls have sat in the hot seat before, they shouldn’t expect a warm welcome.

    The virtual hearing, set for Tuesday, was hastily called after the social networks slowed the spread of a New York Post article that suggested unproven improprieties involving the son of now President-elect Joe Biden. The move enraged Republicans, who viewed it as an effort to support Biden’s candidacy. Given that their candidate, President Donald Trump, lost his reelection bid, Republicans will likely come out swinging, complaining that the companies harbor an anti-conservative bias, which the firms deny.

    The group holding the hearing, the Senate judiciary committee, will also provide another interesting twist to a Capitol Hill proceeding that could be more heated than most. Sen. Kamala Harris, a California Democrat who sits on the committee, has close ties to Silicon Valley and is friendly with Zuckerberg’s No. 2, Sheryl Sandberg. She’s also the vice president-elect, a freshly minted status that likely won’t go unnoticed.

    The proceeding comes nearly three weeks after Zuckerberg, Dorsey and Google CEO Sundar Pichai weathered a combative hearing in front of the Senate commerce committee regarding a law that shields internet platforms from liability for most user-generated content. The new hearing, called Breaking the News: Censorship, Suppression, and the 2020 Election, will likely be a fiery sequel.

    A growing number of Americans are consuming their news on Facebook, Twitter and other social networks. This shift to online news consumption has raised concerns about the health of the media environment, as well as worries about the power that a small group of companies wield over what we see and read. Republicans say the companies are skewed against them and censor their views. Democrats say the companies aren’t doing enough to combat the fact that bad actors have taken advantage of social networks to spread disinformation, misinformation and outright lies.

    Zuckerberg and Dorsey will likely deny they’re censoring content to favor one political party. They’ve pushed back on these allegations many times before. The executives will probably use the hearing to defend their companies’ handling of misinformation during and after the US election.

    Obviously, the election has put a spotlight on political content, which tends to provoke strong emotions irrespective of your philosophy. Facebook says about 6% of content on the social network is political in nature.

    Twitter said it hasn’t shared publicly how much of its content is political. On Thursday, the company said it labeled roughly 0.2% of election-related tweets, or 300,000 of them, for including disputed or misleading content in the period before and after the vote.

    Both social networks have grappled with an onslaught of conspiracy theories, as well as false claims about voter fraud and even who won the election. Major news outlets called the presidential race for Biden, the Democratic challenger. Trump hadn’t conceded as of Saturday morning.

    Twitter took a tougher stance than Facebook did against election misinformation by limiting the reach of tweets, including some of Trump’s. Both Facebook and Twitter labeled Trump posts that included baseless claims about voter fraud, and directed users to online hubs with authoritative election information. Facebook pulled down a massive user group that falsely alleged Democrats were trying to steal the election, after some members called for violence.

    Zuckerberg and Dorsey, already political piñatas, have experience getting smacked by senators. In late October, Dorsey sparred with Sen. Ted Cruz, a Texas Republican, over Twitter’s decision to block links to the Post that included allegations about Biden’s son Hunter. Twitter said it blocked the links because the article violated rules against sharing hacked materials and personal information. But the company executed a quick about-face and stopped blocking the link. It later tweaked the policy again, developments that Cruz, who sits on the judiciary committee, will likely seize on.

    Other notables on the committee include Sen. Lindsey Graham, the South Carolina Republican who chairs it and is a key ally of the president, and Sen. Josh Hawley, a Missouri Republican who’s a vocal critic of Facebook and Twitter. Notable Democrats on the committee include Harris, who’s criticized Facebook in the past for not doing enough to combat misinformation, and Sen. Amy Klobuchar, who represents Minnesota and is being mentioned for positions in the Biden administration.

    On Monday, Biden spokesman Bill Russo said in a series of tweets that Facebook was still “shredding the fabric of our democracy” days after the election and that the company hasn’t taken the problem of disinformation seriously enough.

    “We pleaded with Facebook for over a year to be serious about these problems. They have not,” he tweeted. “Our democracy is on the line.”

    The hearing starts on Tuesday (Nov. 17) at 10 a.m. ET/7 a.m. PT.
    下载开源日报APP:https://opensourcedaily.org/2579/
    加入我们:https://opensourcedaily.org/about/join/
    关注我们:https://opensourcedaily.org/about/love/
  • 开源日报第951期:《翻新照片 Bringing-Old-Photos-Back-to-Life》

    16 11 月, 2020
    开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
    今日推荐开源项目:《翻新照片 Bringing-Old-Photos-Back-to-Life》
    今日推荐英文原文:《Declarative Versus Imperative Code》

    今日推荐开源项目:《翻新照片 Bringing-Old-Photos-Back-to-Life》传送门:项目链接
    推荐理由:这个项目是微软新推出的人工智能修复老照片的项目,包括划痕修复,整体颜色复原和面部修复等过程。目前已经推出了试用 demo,不过该项目的模型使用特定分辨率的图片进行了预训练,因此可能不适用于所有自己上传的照片的分辨率。
    今日推荐英文原文:《Declarative Versus Imperative Code》作者:Martin Novák
    原文链接:https://medium.com/better-programming/declarative-versus-imperative-code-180c0cf4003b
    推荐理由:介绍了各种不同的代码风格

    Declarative Versus Imperative Code

    Terminology and differences in programming paradigms

    Believe it or not, you are likely already using multiple programming paradigms as a developer. Because there is nothing more fun than entertaining your friends with programming theory, here is an article that will help you recognize popular paradigms in your code.

    Imperative Code

    Imperative programming is how we started with Assembly (1949) and continued with languages like C, C++, C#, PHP, and Java. Procedural and object-oriented programming belong under the imperative paradigm.

    Your code is based on statements that change the program state by telling the computer how to do things. In other words, your code is based on defining variables and changing the values of those variables.

    It is the ideal programming paradigm for people who have a less-than-innocent fetish for telling machines how to do their thinking.

    Procedural code

    Procedural code uses procedures to manage its structure. A procedure is simply a set of actions run in a specific order that you are able to call repeatedly instead of jumping by using goto commands.
    #include <stdio.h>
    int main()
    {
        int num1, num2, num3;
        int *p1, *p2, *p3;
    
        //taking input from user
        printf("Enter First Number: ");
        scanf("%d",&num1);
        printf("Enter Second Number: ");
        scanf("%d",&num2);
        printf("Enter Third Number: ");
        scanf("%d",&num3);
    
        //assigning the address of input numbers to pointers
        p1 = &num1;
        p2 = &num2;
        p3 = &num3;
        if(*p1 > *p2) {
        if(*p1 > *p3){
            printf("%d is the largest number", *p1);
        }else{
            printf("%d is the largest number", *p3);
        }
        }else{
        if(*p2 > *p3){
            printf("%d is the largest number", *p2);
        }else{
            printf("%d is the largest number", *p3);
        }
        }
        return 0;
    }
    
    The above example in C language reads three numbers, uses pointers, and through conditional logic drives the program flow to determine the largest number out of the three. Procedural languages like C can offer you a fairly simple and very computing efficient solution to application challenges.

    You usually need to read each procedure from top to bottom to understand what it does. Procedural programmers can be sometimes criticized for a tendency of writing spaghetti code. But any college student who hasn’t been dependent on spaghetti with ketchup for dinner had it easy in life.

    Examples of procedural programming languages are Pascal (1970) and C (1972). Procedural programming has strong support. Linus Torvalds, the father of Linux, has been quite open in his criticism of C++ and object-oriented programming.

    Object-oriented code

    Object-oriented programming is modeling objects that hold internal states. The programming code is then based on the relationship among these objects. In classed-based languages, objects are instances of classes.

    The code in the methods of the objects is still imperative and based on statements that modify the state.
    public interface Retile {
       void walk();
    }
    
    public class Turtle implements Reptile {
       @Override
       public void walk() {
          System.out.println("Turtle is walking!");
       }
    }
    
    public class Tortoise implements Reptile {
       @Override
       public void walk() {
          System.out.println("Tortoise is walking!");
       }
    }
    
    public class ReptileFactory {
       public Reptile getReptile(String reptileType){
          if(reptileType == null){
             return null;
          }     
          if(reptileType.equalsIgnoreCase("TURTLE")){
             return new Turtle();
          } else if(shapeType.equalsIgnoreCase("TORTOISE")){
             return new Tortoise();
          }
          return null;
       }
    }
    
    public class ReptileDemo {
       public static void main(String[] args) {
          ReptileFactory reptileFactory = new ReptileFactory();
    
          Reptile reptile = Reptile.getReptile("TURTLE");
    
          reptile.walk();
       }
    }
    
    The above is an example of a factory design pattern implemented in Java. Notice how all the code focuses on defining classes and using a relationship among them through an interface. Usually, all these classes would be separated out into their own files.

    Examples of object-oriented languages are Smalltalk (1972), C++ (1985), Python (1991), Java (1995), JavaScript (1995), Ruby (1995), C# (2000), Scala (2004), and Swift (2014).

    JavaScript started as a prototype-based, object-oriented language without classes. Classes were added in ECMAScript 6 in 2015.

    When you are studying programming, chances are that, of all the paradigms, you will encounter object-oriented code first and most. Even though it is the most popular paradigm, it still meets with serious criticism for its complexity, difficulty of understanding design patterns, and tricky state management across the application. At the same time, object-oriented programming languages are very mature and professionally appreciated.

    In JavaScript, the front-end framework Angular is a great example of C# having a big influence on developers wanting to bring stronger object-oriented principles into web development.

    Please continue using object-oriented programming in all your projects. Because if you don’t, all the people that know only this one paradigm will suddenly be out of a job and live in cardboard boxes. And you don’t want to be responsible for that, do you?

    Declarative Code

    Declarative code is very common, and it is represented by domain-specific, logic, and functional programming languages. Examples of these are HTML, SQL, F#, Prolog, and Lisp.

    Declarative code focuses on expressions that are saying what without adding how. For example, HTML code <img src=”./turtle.jpg” /> tells the browser to display an image of a turtle without telling the browser how. It is also typical that a declarative code avoids mutation of state and variables.

    Domain-specific code

    Domain-specific languages are not Turing complete, which means that they can’t do everything that other Turing-complete languages can. For example, C# (imperative) and F# (declarative) are both Turning-complete languages, and everything that you can develop in one, you can also develop in the other one. HTML is not Turing-complete and allows you to do only specific things.

    An example of SQL code that finds employees and their managers in a database:
    SELECT e.name, m.name FROM Employee e, Employee m WHERE e.Employee_id=m.Manager_id;
    
    Domain-specific languages are usually very simple to write and read. Because of that fact, they are the most popular way of user interface declaration. For example, the JavaScript programming library React uses JSX for defining components:
    const myComponent = props => (
    
    
    

    Hello, {props.userName}

    };
    Examples of domain-specific languages are SQL (1974), HTML (1993), CSS (1996), and XML (1996).

    Logic code

    Logic programming is a declarative paradigm based on formal logic. A program is a set of sentences in a logical form that express facts and rules about some problem domain.

    The most typical logic programming language that is Turing-complete is Prolog (1972). That means that everything that you can write in C language you can in theory also write in Prolog.

    Prolog is based on defining predicates that define the relationship between their arguments.
    food(salad). % <- salad is food fact
    food(pizza). % <- pizza is food fact
    
    ?- food(salad). % <- is salad food? True
    ?- food(turtle). % <- is turtle food? False
    
    In the example above, you define facts that result in true and then you ask questions that again result in true or false boolean.

    Remember that turtles are not food and someone should tell that to the starving people on Naked and Afraid.

    Prolog is kinda magical when you work in it, and if you disagree then you are an evil baby-eater anyway.

    Functional code

    Functional programming is a declarative paradigm based on a composition of pure functions. Functional programming languages are Turing complete and based on lambda calculus, which is a system of mathematical logic from the 1930s.

    A pure function is a function that depends only on its input and always provides an output without mutating or reading any external state. That is very different from procedural programming. Function composition is then about using simple functions together in a sequence to build your code.

    Functional programming has been growing steadily in its popularity in the past years, and it has made its way into imperative programming languages. That means that languages such as Python, C++, and JavaScript are multiparadigmatic as they support writing code in multiple paradigms.

    Here is an example of a functional code written in JavaScript using the @7urtle/lambda library:
    import {upperCaseOf, trim, map, compose, Maybe} from '@7urtle/lambda';
    
    const getElement = selector => Maybe.of(document.querySelector(selector));
    const getText = element => element.textContent;
    const transformer = compose(trim, upperCaseOf);
    const getElementText = compose(map(transformer), map(getText), getElement);
    
    getElementText('#myTurtle'); // => Maybe('SHELLY')
    
    Functional programming brings a number of new concepts that are not present in object-oriented programming like pure functions, higher-order functions, immutability, functors, partial application, point-free functions, and so on. Because of that, the barrier of entry can be seemingly high, especially since many functional programming articles like to go very deep into its mathematic roots. I recommend having a look at simple articles like @7urtle/lambda JavaScript functional programming basics(https://www.7urtle.com/javascript-functional-programming-basics)for the introduction.

    Only evil wizards think that functional programming is bad. So be clever, don’t listen to their wicked curses, and instead burn them at the stake where they belong. And remember that if someone says that monads are difficult, it’s just fake news.

    Other examples of functional programming languages are LISP (1984), Haskell (1990), and F# (2005).

    Study Your Programming Craft

    Many programmers out there are really familiar only with the imperative and object-oriented approach to software development. Learning of other paradigms helps you to become a better developer even if you don’t end up jumping over the fence.
    下载开源日报APP:https://opensourcedaily.org/2579/
    加入我们:https://opensourcedaily.org/about/join/
    关注我们:https://opensourcedaily.org/about/love/
←上一页
1 … 20 21 22 23 24 … 262
下一页→

Proudly powered by WordPress