我如何找到方法?

发布于 2024-10-01 14:33:12 字数 161 浏览 14 评论 0原文

这是一个比较普遍的计算机问题。我一直能够遵循编程的逻辑,但是当我去编写某些东西时,我总是发现我不知道某种方法或另一种方法来完成我需要完成的事情。当我看到它时,我总是想:“当然!”。

您如何找到满足您的编程需求的“内置”相关方法?我不喜欢重新发明轮子,但我发现很难找到做我想做的事情所需的东西。

Here's a somewhat general computer question. I've always been able to follow the LOGIC of programming, but when I go to code something, I always find that I don't know some method or another to get what I need to get done. When I see it, I always think, "OF COURSE!".

How do you go about finding relevant methods for your programming needs that are "built-in?" I don't enjoy re-inventing the wheel, but I find it difficult to find what I need to do what I want to do.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

我做我的改变 2024-10-08 14:33:12

首先尝试Google:

您可以使用Google搜索您需要的方法。例如,如果我想在 PHP 中搜索数组中的值,那么我会转到 Google 并输入“在 PHP 中搜索数组中的值"。我首先找到了我的所需的函数

然后尝试标准文档:

尝试标准文档来搜索您所需的方法。例如,如果我的问题与 PHP 中的字符串有关,那么我会转到 字符串函数文档并找到所需的功能。

最后尝试 Stackoverflow:

否则您可以在 Stackoverflow 上询问您所需的方法和库。你总会找到一条最短路线。

First try Google:

You can use google to search your required method. For example If I want to search a value in array in PHP then I go to Google and type "Search values in array in PHP". I find my required function at first place.

Then try Standard Documentation:

Try standard documentation to search for your required method. For example if my problem is related to strings in PHP then I go to String Functions documentation and find the required function.

Finally try Stackoverflow:

Otherwise you can ask your problem at Stackoverflow for your required methods and libraries. You will always get a shortest way.

心房的律动 2024-10-08 14:33:12

您在这里询问的是进行研究的最佳方法。嗯,这是很难解释的技能,更难教授。

不过,这里有一些提示:

  1. 访问搜索引擎。它使得不
    感觉从 MSDN 这样的地方开始,
    因为它的所有内容都已编入索引
    无论如何,通过搜索引擎。
    表述你的问题几个
    不同的方式。
  2. 当你了解更多的时候
    关于这个问题你将学到新的知识
    关于它的词汇。使用那个新的
    词汇来进行更多搜索。
  3. 如果搜索结果为空,
    切换到浏览特定的
    官方部分
    您认为是的文档
    与你正在做的事情最相关。如果不出意外的话,它将扩大你对这个问题的视野,并为你提供更多词汇来进行更多搜索。
  4. 最后,如果一切都失败了,请在 StackOverflow 上提问,尽可能清楚地解释你想要做什么。

请注意,如果有一个简单的 API 可以满足您的需要,您很少会到达步骤 4。

What you are asking here is for the best way to do research. Well, that's hard skill to explain, even more so to teach.

Nevertheless here are some tips:

  1. Go to a search engine. It makes no
    sense to start in a place like MSDN,
    since all of its content is indexed
    by the search engines anyway.
    Phrase your question several
    different ways.
  2. As you learn more
    about the issue you will learn new
    vocabulary about it. Use that new
    vocabulary to do even more searches.
  3. If the searches turn out empty,
    switch to browsing a specific
    section of the official
    documentation that you think is the
    most related to what you are doing. If nothing else, it will expand your horizons around the issue and give you more vocabulary to do more searches.
  4. Finally, if all else fails ask a question on StackOverflow explaining what you want to do as clearly as possible.

Note that if there's a simple API that does what you need, you will rarely reach step 4.

银河中√捞星星 2024-10-08 14:33:12

你说:

突然发现很沮丧
中间有一个“简单”按钮。

尝试以不同的方式看待它。将这些时刻视为祝福。你刚刚学到了一些东西。你投入了大量的努力,而不是认为这些努力被浪费了,而是认为它对正确的学习至关重要。你——比刚刚偶然发现魔法方法的人更好——真正理解它的用途以及它的工作原理。你真的真的明白为什么你需要它,并且你正确地欣赏它的价值。你永远不会忘记这个方法。

所以成本很高,但你学到了一些重要的东西。庆祝一下,然后继续前进。

You say:

It's very frustrating to suddenly find
an "easy" button mid-way through.

Try to see it differently. Think of these moments as blessings. You've just learned something. You invested a lot of effort - and instead of seeing that effort as wasted, see it as critical to proper learning. You - better than the guy who just happened across the magic method - really understand what it's for and something about how it works. And you really, really, understand why you need it, and you properly appreciate its value. You're never going to forget that method.

So it was costly, but you learned something important. Celebrate, and move on.

阳光的暖冬 2024-10-08 14:33:12

它通常包含在某种形式的文档中。大多数 IDE 支持文档格式并为您提供自动完成功能。

It is usually included in some form of documentation. Most IDEs support the documentation format and gives you auto-complete functionality.

攀登最高峰 2024-10-08 14:33:12

如果您使用的是 MVS,那么 MSDN 非常适合它

if you are using MVS so MSDN is really good for it

笔芯 2024-10-08 14:33:12

除了这个这个上面的答案,谷歌的基本高级搜索提示非常有用。

除了上述之外,更改搜索条件中关键字的顺序也会以不同的顺序对列表进行排序。

从本质上讲,我相信搜索仍然是一门艺术,而不是一门科学,并且最好是学习 - 引用上面 David Reis 的回答:“2. 当你对这个问题了解更多时,你将学习关于它的新词汇。使用新词汇进行更多搜索。”

In addition to this and this answer above, google's basic and advanced searching tips prove very helpful.

In addition to above, changing the order of keywords in search criteria also sorts the list in different orders.

In essence I believe that searching is still an art rather than a science, and is best learnt - quoting from David Reis' answer above: "2. As you learn more about the issue you will learn new vocabulary about it. Use that new vocabulary to do even more searches."

内心旳酸楚 2024-10-08 14:33:12

在 API 文档中搜索。但最好的方法(我发现是这样)是在互联网上搜索多种解决方案,然后选择您认为最好的一个。让您的搜索范围尽可能缩小。例如你想实现随机数生成功能,然后像这样搜索“如何在Java中生成随机数?”。

Search in the API documentation. But the best way to (I found so) is to search on the internet for multiple solutions and then choose the one that you think is best. Make your search as narrow as possible. For example you want to implement random number generation function, then search like this, "How to generate random numbers in Java?".

青衫儰鉨ミ守葔 2024-10-08 14:33:12

命名空间、命名约定、自动完成/智能

我假设您正在尝试找到某种面向对象的 api 。我在示例中使用 .net。

首先尝试找到一个可能负责您正在寻找的方法的类。

示例:如果您想“在文件系统中创建一个新目录”,您必须知道(或了解)(在 dotnet 中)这些类位于命名空间 System.IO 中:

该命名空间包含子命名空间(如 Compressionion)和类(如 File、Path、目录,...

其次你应该知道命名约定。 Get、Set、Insert、Create 等方法有常见的命名前缀。在类 Directory 的文档中,您将找到 CreateDirectory-Method。

如果您有一个了解您的编程语言以及类和命名空间的智能编辑器,那么学习就会容易得多。在 dotnet 世界中,此功能称为自动完成/智能

Namespaces, namingconventions, Autocomplete/Intellisence

I assume that you are trying to find some kind of Object-Oriented-apis . I use .net in my example.

First try to find a class that might be responsable for the method you are looking for.

Example: If you want to "Make a new Directory in the Filesystem" you must know (or learn) that (in dotnet) these classes are in the namespace System.IO:

This namespace contains subnamespaces like Compresseion and Classes like File, Path, Directory, ...

Second you sould know NamingConventions. There are common Naming-Prefixes for methods like Get, Set, Insert, Create. In the documentation for class Directory you will find a CreateDirectory-Method.

If you have an intelligent editor that knows your programming language and the classes and namespaces learning is much easier. In the dotnet-world this feature is called Autocomplete/Intellisence

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文