ecw2c认真有效地在线查找帮助!

Here’s a situation that might sound familiar: you’re in the middle of a project, and you realize you’re tackling a problem you haven’t seen before. Perhaps your search function query is returning too many results, which is slowing down your website. You figure you shouldn’t display the data all at once, and you’ve heard about something called “pagination,” which sounds close enough. So, you quickly look through the codebase for similar examples, and then google “pagination” + “[your stack]”. An hour later, you have 17 open tabs, a growing headache, and no actual progress on your project. Congrats, you’ve officially gone down the research rabbit hole! 

As the sun is starting to come up on a new day, you stumble across some library code that seems relevant, so you copy it over, and it seems to work. You don’t fully understand why, but the code runs and the tests pass. So, you move on, and everything is fine — until a few days later, someone else pushes a change, and everything breaks.

As developers, we’re constantly researching new approaches, processing new information, and selecting the best solutions under deadlines. Having to research isn’t a signal that you don’t know enough — it’s a crucial part of the job. Terry O’Shea, a software engineer at Etsy, says she looks things up “dozens of times a day… I’ve spent more than a few sweaty half-hours phrasing and rephrasing a search query.” Learning to research effectively is a significant part of leveling up as a developer.


The trap many beginners fall into is following a solution that seems close enough. It’s incredibly easy to get lost if you only have a vague sense of what you need. At best, you’ll stumble onto a working solution without really understanding it; at worst, you’ll find yourself frustrated and way off course. I’ve been there myself while working as a software engineer at Bonus.ly and the NYC Mayor’s Office. There is no perfect process, and different approaches work for different people. However, one trick I’ve found to be quite conducive to effective research is to stay mindful through the process.


第1步:了解景观

Before you start wading through search results, start by defining your problem in the clearest way you can. Aim to understand, broadly, what the high-level moving pieces are. This may feel tricky at first, but considering how to word your question will help you understand it, remember it, and communicate it to others. James Mayr, a product manager at The Muse, finds it helpful to front-load this process: “I try to do the research long before I get to the actual coding; if I have to look something up during the middle of a coding session, it totally pulls me out of the flow.”

In the earlier example, pagination is just one possible solution to a slow page load. If you take time to explore the underlying problem you’re facing (a large, slow server response), you’ll find other possibilities. You might implement infinite scrolling, refactor your database queries, cache search results, or even redesign your UX so users initially request more specific data. Forming a sense of the landscape will help you narrow in on an appropriate, effective solution rather than chasing a close enough one.

Beware of the XY problem — where, instead of asking for your actual problem, you ask about your best hypothesis, and get an answer to a whole other question. As you research, keep asking yourself: “Does this resource help me do X, the problem I just defined?” It might sound trite, but if the answer is anything like, “Well, it helps me do Z, which helps with Y, which is how I can do X,” you’ve probably gone too far. 

第2步:选择资源

You’ll need different resources at different stages of the research process, so be cognizant of the type of resource you’re looking for. For example, if you’re struggling to understand the concept of hashing (a cryptography technique commonly used to obscure sensitive data), reading a tutorial on bcrypt (a popular hashing library) is probably not the best use of your time.

As you search the internet, you’ll find roughly four types of resources: 

  • 技术文档(MDN,API文档)
  • 教程(Medium,FreeCodeCamp,特定于工具)
  • 在线讨论(Stack Overflow,Reddit,HackerNews) < li>来自教程和论坛的代码示例
Start broadly — look for a Wikipedia article, MDN documentation, or W3Schools. When I was learning to research, I created a whole website, Hackterms, to crowdsource coding jargon that can sometimes be a stumbling block. Then, once you understand the concept at a high level, you can search for relevant blog posts, tutorials, and Stack Overflow responses to help you write code. If you browse message boards, don’t get caught up in the arguments about which tool is best until you understand what they actually do.

This may seem like a small change, but constantly evaluating if you’re looking at the right type of resource will force you to be more discerning, and will save you lots of time. It’s easy to get distracted reading a tutorial that sort of makes sense, but remember: your goal isn’t just to get the code working; it’s to write code you can understand and maintain.

Although the internet is full of knowledge, sometimes the most effective way to get an answer at work may be from your colleagues. Esther Leytush, a full-stack developer at Betterment, says her rule of thumb is to “google anything that I can frame as ‘How do I…’ and ask coworkers, technical leads, or managers when the question can only be framed as ‘Should we…?’ Your colleagues are the best resources on domain- and process-specific knowledge, and can often help you get unstuck. “If an obstacle that’s stopped your work for half an hour,” says Etsy’s O’Shea, “definitely take it to a colleague — maybe they’ll know the solution; maybe they’ll just commiserate.”


第3步:编写代码


As you narrow down your choices towards the solution you actually need, you can start looking for specific tutorials or documentation. Now, you can shift from trying to understand the landscape to finding and writing code that solves your problem. 

At this stage, make sure you don’t copy over blocks of code without understanding every line. Many tutorials oversimplify the problem for the sake of brevity and clarity, but the sample code they use is often not suitable for production. Copying blocks of code will lead to technical issues when you can’t explain or maintain your work, and ethical issues around plagiarism and intellectual property. Moreover, by taking the time to rewrite and customize the solution now, you’ll find it easier to understand similar problems the next time. 

第4步:现在进行认真的研究=未来的障碍会更少


As with everything else in life, you’ll get better at research with practice. You’ll find it easier to reach the right resources using the right words, and the knowledge you gain from mindful research will illuminate areas of programming that used to seem daunting. “I’m more discerning about the solutions I find,” says O’Shea. “Instead of just copying and pasting someone’s hacky CSS, I’ll keep searching until I find the most idiomatic, performant, concise, or elegant way to accomplish what I want.” 

So, the next time you run into a scary new problem, don’t immediately reach for Google. Define the problem, identify the resources you’ll need, stay mindful, and remember — this isn’t just how you solve the problem in front of you, it’s how you become a better developer.

Tags: bulletin, coding, mental health, mindfullness, research, software development
from:https://stackoverflow.blog/2019/07/30/find-help-online-mindfully-and-effectively/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
SQLAlchemy 是一个 SQL 工具包和对象关系映射(ORM)库,用于 Python 编程语言。它提供了一个高级的 SQL 工具和对象关系映射工具,允许开发者以 Python 类和对象的形式操作数据库,而无需编写大量的 SQL 语句。SQLAlchemy 建立在 DBAPI 之上,支持多种数据库后端,如 SQLite, MySQL, PostgreSQL 等。 SQLAlchemy 的核心功能: 对象关系映射(ORM): SQLAlchemy 允许开发者使用 Python 类来表示数据库表,使用类的实例表示表中的行。 开发者可以定义类之间的关系(如一对多、多对多),SQLAlchemy 会自动处理这些关系在数据库中的映射。 通过 ORM,开发者可以像操作 Python 对象一样操作数据库,这大大简化了数据库操作的复杂性。 表达式语言: SQLAlchemy 提供了一个丰富的 SQL 表达式语言,允许开发者以 Python 表达式的方式编写复杂的 SQL 查询。 表达式语言提供了对 SQL 语句的灵活控制,同时保持了代码的可读性和可维护性。 数据库引擎和连接池: SQLAlchemy 支持多种数据库后端,并且为每种后端提供了对应的数据库引擎。 它还提供了连接池管理功能,以优化数据库连接的创建、使用和释放。 会话管理: SQLAlchemy 使用会话(Session)来管理对象的持久化状态。 会话提供了一个工作单元(unit of work)和身份映射(identity map)的概念,使得对象的状态管理和查询更加高效。 事件系统: SQLAlchemy 提供了一个事件系统,允许开发者在 ORM 的各个生命周期阶段插入自定义的钩子函数。 这使得开发者可以在对象加载、修改、删除等操作时执行额外的逻辑。
SQLAlchemy 是一个 SQL 工具包和对象关系映射(ORM)库,用于 Python 编程语言。它提供了一个高级的 SQL 工具和对象关系映射工具,允许开发者以 Python 类和对象的形式操作数据库,而无需编写大量的 SQL 语句。SQLAlchemy 建立在 DBAPI 之上,支持多种数据库后端,如 SQLite, MySQL, PostgreSQL 等。 SQLAlchemy 的核心功能: 对象关系映射(ORM): SQLAlchemy 允许开发者使用 Python 类来表示数据库表,使用类的实例表示表中的行。 开发者可以定义类之间的关系(如一对多、多对多),SQLAlchemy 会自动处理这些关系在数据库中的映射。 通过 ORM,开发者可以像操作 Python 对象一样操作数据库,这大大简化了数据库操作的复杂性。 表达式语言: SQLAlchemy 提供了一个丰富的 SQL 表达式语言,允许开发者以 Python 表达式的方式编写复杂的 SQL 查询。 表达式语言提供了对 SQL 语句的灵活控制,同时保持了代码的可读性和可维护性。 数据库引擎和连接池: SQLAlchemy 支持多种数据库后端,并且为每种后端提供了对应的数据库引擎。 它还提供了连接池管理功能,以优化数据库连接的创建、使用和释放。 会话管理: SQLAlchemy 使用会话(Session)来管理对象的持久化状态。 会话提供了一个工作单元(unit of work)和身份映射(identity map)的概念,使得对象的状态管理和查询更加高效。 事件系统: SQLAlchemy 提供了一个事件系统,允许开发者在 ORM 的各个生命周期阶段插入自定义的钩子函数。 这使得开发者可以在对象加载、修改、删除等操作时执行额外的逻辑。
GeoPandas是一个开源的Python库,旨在简化地理空间数据的处理和分析。它结合了Pandas和Shapely的能力,为Python用户提供了一个强大而灵活的工具来处理地理空间数据。以下是关于GeoPandas的详细介绍: 一、GeoPandas的基本概念 1. 定义 GeoPandas是建立在Pandas和Shapely之上的一个Python库,用于处理和分析地理空间数据。 它扩展了Pandas的DataFrame和Series数据结构,允许在其中存储和操作地理空间几何图形。 2. 核心数据结构 GeoDataFrame:GeoPandas的核心数据结构,是Pandas DataFrame的扩展。它包含一个或多个列,其中至少一列是几何列(geometry column),用于存储地理空间几何图形(如点、线、多边形等)。 GeoSeries:GeoPandas中的另一个重要数据结构,类似于Pandas的Series,但用于存储几何图形序列。 二、GeoPandas的功能特性 1. 读取和写入多种地理空间数据格式 GeoPandas支持读取和写入多种常见的地理空间数据格式,包括Shapefile、GeoJSON、PostGIS、KML等。这使得用户可以轻松地从各种数据源中加载地理空间数据,并将处理后的数据保存为所需的格式。 2. 地理空间几何图形的创建、编辑和分析 GeoPandas允许用户创建、编辑和分析地理空间几何图形,包括点、线、多边形等。它提供了丰富的空间操作函数,如缓冲区分析、交集、并集、差集等,使得用户可以方便地进行地理空间数据分析。 3. 数据可视化 GeoPandas内置了数据可视化功能,可以绘制地理空间数据的地图。用户可以使用matplotlib等库来进一步定制地图的样式和布局。 4. 空间连接和空间索引 GeoPandas支持空间连接操作,可以将两个GeoDataFrame按照空间关系(如相交、包含等)进行连接。此外,它还支持空间索引,可以提高地理空间数据查询的效率。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值