If you have ever wondered "method adalah" — Indonesian for "what is a method" — you are not alone. The word shows up everywhere in crypto, blockchain, and AI, and yet most beginners gloss over what it really means. A method is simply a reusable block of code that performs a specific task, and understanding methods is the difference between hacking together a project and actually engineering one.

Whether you are writing a Solidity smart contract, training a machine learning model, or building an analytics dashboard for on-chain data, methods are the building blocks that keep your logic clean, testable, and scalable. Let us break it down in plain English, with the kind of practical examples you can actually use.

Method Adalah: The Core Definition You Actually Need

At its simplest, a method is a named function attached to an object, class, or contract. Think of it as a labeled action: you call the method's name, pass in some inputs (called arguments or parameters), and you get a result back. In JavaScript, Python, Solidity, and most modern languages, methods are how programmers package behavior.

Why does this matter for crypto and AI? Because both fields live and die on reusable logic. A smart contract might have a method called transfer() that moves tokens from one wallet to another. An AI pipeline might have a method called predict() that returns a classification for a given input. Without methods, every line of logic would be duplicated, error-prone, and impossible to audit.

Methods vs. Functions: Is There a Difference?

Technically, yes. A function is a standalone block of code. A method is a function that belongs to an object or class. In practice, the terms are used interchangeably in most casual conversation, including in Solidity docs and Python AI libraries. For the purposes of this guide, treat them as synonyms.

Methods in Smart Contracts: Where the Money Meets the Code

Solidity smart contracts are essentially collections of methods. Every time you swap tokens on a DEX, mint an NFT, or stake into a yield farm, you are calling a method on a deployed contract. These methods are public by default, which means anyone can read them on-chain, and the ones that change state are the ones that actually cost gas.

Here are the method categories you will see most often:

  • View and pure methods — read-only functions that do not modify the blockchain. They cost no gas to call from off-chain.
  • Write methods — state-changing functions like transfer(), approve(), or mint() that require a transaction and gas fees.
  • Payable methods — special functions that can receive ETH or native tokens alongside the call.
  • Constructor method — runs once at deployment to initialize the contract.

Understanding which method you are calling, and what state it changes, is the foundation of smart contract security. Most exploits in crypto history trace back to a misunderstood method — reentrancy bugs, improper access control on withdraw(), or uninitialized ownership on a setter method.

Real-World Example: The ERC-20 Transfer Method

The ERC-20 token standard defines a transfer(address to, uint256 amount) method that every fungible token on Ethereum must implement. When you send USDT to a friend, your wallet is calling this method on the USDT contract. The method checks your balance, subtracts the amount, adds it to the recipient, emits a Transfer event, and returns true. One small method, billions of dollars of value flowing through it daily.

Methods in AI: From Training Loops to Prediction Pipelines

On the AI side, methods take on a slightly different flavor but the principle is identical. Every modern AI framework — PyTorch, TensorFlow, Hugging Face Transformers — structures its code around methods. You define a class, give it methods like forward(), train_step(), and evaluate(), and the framework handles the rest.

In machine learning specifically, the word "method" also refers to the algorithmic approach you use to solve a problem. You will hear phrases like "our method outperforms the baseline" in research papers. In that context, "method" means the full recipe: the model architecture, the loss function, the training procedure, and the data preprocessing pipeline bundled together.

  • Supervised learning methods — train on labeled data to predict outcomes.
  • Unsupervised methods — find patterns in unlabeled data, often used for clustering or anomaly detection in on-chain analytics.
  • Reinforcement learning methods — train agents through reward signals, increasingly used in trading bots and MEV searchers.
  • Fine-tuning methods — adapt a pre-trained model to a specific task, like teaching an LLM about a new smart contract language.

Why Method Design Matters in AI Products

Just like in smart contracts, poorly designed methods in AI pipelines lead to silent failures. A preprocess() method that does not normalize inputs the same way during training and inference will produce a model that works in tests but breaks in production. A load_data() method that shuffles the test set will leak information and inflate your accuracy metrics. The discipline of writing clean, single-purpose methods is what separates research demos from deployable AI products.

Choosing the Right Method for Your Project

So how do you decide which methods to write, and how to structure them? Start with the principle of single responsibility — every method should do one thing, and do it well. If your swap() method in a DEX contract also updates a reward accumulator and triggers an external oracle call, you have three methods masquerading as one, and three times the audit surface.

A few practical rules of thumb:

  1. Name methods by intent, not implementation. calculateReward() beats loopAndSum() every time.
  2. Keep method signatures minimal. More parameters mean more ways to call something wrong.
  3. Document expected behavior, including failure modes. What happens if a user passes zero? What if the AI model receives an empty input?
  4. Write tests at the method level. Unit tests on individual methods catch bugs long before integration tests do.

Whether you are deploying a Solidity contract, fine-tuning a transformer, or building a crypto analytics tool, the methods you write are the public face of your logic. Other developers, auditors, and users will read them, call them, and trust them. Treat them like an API, because in a very real sense, they are.

Key Takeaways

  • A method is a reusable, named block of code that performs a specific task — the basic unit of behavior in any program.
  • In smart contracts, methods are public, on-chain functions that move value, so their design directly impacts security and gas efficiency.
  • In AI, methods structure both the code (training loops, prediction pipelines) and the conceptual recipe (the algorithm plus its data and loss).
  • Good method design — single responsibility, clear naming, minimal signatures, and thorough tests — is what separates production-grade systems from weekend prototypes.
Method adalah not just a definition to memorize. It is a mindset: package your logic, name it well, test it hard, and let it do one job brilliantly.