How to find methods?

Here are a few general computer issues. I was always able to follow the LOGIC programming, but when I do something, I always find that I donโ€™t know any method to get what I need to do. When I see this, I always think: "COURSE!".

How can you find suitable methods for your programming needs that are "built-in"? I don't like reinventing the wheel, but it's hard for me to find what I need to do, what I want to do.

+4
source share
8 answers

Try google first:

You can use Google to find the method you need. For example, if I want to search a value in array in PHP , then I go to Google and type โ€œSearch for values โ€‹โ€‹in an array in PHP .โ€ I find the required function in the first place.

Then try the standard documentation:

Try the standard documentation to find the required method. For example, if my problem is with strings in PHP, I go to String Functions and find the function I need.

Finally try Stackoverflow:

Otherwise, you can ask your problem in Stackoverflow for your required methods and libraries. You will always get the shortest path.

+6
source

What you are asking here is the best way to do research. Well, this is a difficult ability to explain, much less teach.

However, here are some tips:

  • Go to the search engine. It does not make sense to start in a place like MSDN, since all its contents are indexed by search engines. Divide your question in several different ways.
  • When you learn more about a problem you will learn new vocabulary. Use this new dictionary for even more search.
  • If the search turns out to be empty, switch to viewing a specific section of the official documentation, which you consider most of which is related to what you are doing. If nothing else, it will expand your horizons around the problem and give you more dictionaries to make more queries.
  • Finally, if all else fails to ask a question about StackOverflow, explaining what you want to make as clear as possible.

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

+4
source

You speak:

It is very unpleasant to suddenly find a โ€œlightโ€ button in the middle of the path.

Try to see it differently. Think of these points as blessings. You just learned something. You put in a lot of effort - and instead of seeing that the effort wasted sees it as critical for proper training. You are better than the guy who just happened by the magic method - you really understand what it is for and something about how it works. And you really, really, understand why you need it, and you correctly evaluate its value. You will never forget this method.

It was so expensive, but you learned something important. Celebrate and move on.

+3
source

It is usually included in some form of documentation. Most IDEs support the documentation format and provide autocomplete features.

+2
source

if you use MVS, so MSDN is really good for it

+1
source

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

+1
source

In addition to these and these, answer above, google basic and advanced search tips are very helpful.

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

In essence, I believe that search is still an art, not a science, and the best way to learn is by quoting David Reisโ€™s answer above: โ€œ2. When you learn more about this problem, you will learn a new vocabulary about it. This new dictionary looking even more. "

+1
source

Namespaces, Naming Conventions, AutoComplete / Intellisence

I assume that you are trying to find some Object-Oriented-apis. I am using .net in my example.

First, try to find a class that may be responsible for the method you are looking for.

Example. If you want to "Create a new directory in the file system", you should know (or learn) that (in dotnet) these classes are in the System.IO namespace:

This namespace contains subtitle spaces such as Compresseion and Classes such as File, Path, Directory, ...

Secondly, you can know NamingConventions. There are common Naming-Prefixes for methods such as Get, Set, Insert, Create. In the documentation for Class Directory, you will find the CreateDirectory method.

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

0
source

All Articles