CARVIEW |
Select Language
HTTP/2 200
date: Wed, 30 Jul 2025 23:19:14 GMT
content-type: text/html; charset=utf-8
cf-ray: 96789469ea49c1cc-BLR
cf-cache-status: DYNAMIC
cache-control: private
set-cookie: prov=c0d215b3-f11b-42a6-b942-c7f4d3f3c306; expires=Thu, 30 Jul 2026 23:19:14 GMT; domain=.stackexchange.com; path=/; secure; httponly
strict-transport-security: max-age=31536000; includeSubDomains
vary: Accept-Encoding
content-security-policy: upgrade-insecure-requests; frame-ancestors 'self' https://stackexchange.com
x-clacks-overhead: GNU Terry Pratchett
x-frame-options: SAMEORIGIN
x-request-guid: 47fe234c-9f76-405e-8bc3-78c4f3989983
x-worker-origin-response-time: 397000000
x-dns-prefetch-control: off
set-cookie: prov=c0d215b3-f11b-42a6-b942-c7f4d3f3c306; Path=/; HttpOnly; Domain=stackexchange.com
set-cookie: __cf_bm=Fe1l7mz9jFIYlDRPfgjgY9nw30JkJ75.u4NF3wTvF04-1753917554-1.0.1.1-Z9zzCT74t_xPHOjj_JL3kjnwJ8qvEpFT7QT50U97I2LSUWlXCysKNvw2e5A1h6VrHN4HcZxkSdllyppJHUpF77pnTBby6m9YugEAOII8uoA; path=/; expires=Wed, 30-Jul-25 23:49:14 GMT; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
set-cookie: _cfuvid=PNgy3DMDV2c688avebmz4o_634npDpgFaTLGueokSUc-1753917554637-0.0.1.1-604800000; path=/; domain=.stackexchange.com; HttpOnly; Secure; SameSite=None
server: cloudflare
content-encoding: gzip
Newest 'functions' Questions - Software Engineering Stack Exchange
Skip to main content
Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more.
View results.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsQuestions tagged [functions]
Function is a block of code which performs a specific task.
326 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
7
votes
8
answers
888
views
Why is "one function do more than one thing" a disadvantage of "boolean parameter", but not in "polymorphism"?
According to Is it wrong to use a boolean parameter to determine behavior?, I know using boolean parameters to decide the behaviour is bad, for example, when using boolean parameters as the following:
...
2
votes
3
answers
2k
views
Is refactoring scattered functions into a class always a good idea?
Straight to the point, here's the original code:
integer = input(...)
size = len(integer)
# Created three dicts for matching numbers as keys to corresponding words
dic_ones = {...}
dic_tens = {...}
...
9
votes
7
answers
3k
views
If the sleep time of a function at first time differs from the second time, but the output is the same, is it still a idempotent function?
For example, if the sleep time of a function would change after first execution but the output remains unchanged, e.g.:
public static int myFunction(){
try {
Thread.sleep(MyClass....
7
votes
6
answers
1k
views
Is a callback function with `this` as an argument a bad practice?
I have a class that has a callback function that gets triggered on some event. The user of the class instance is expected to do stuff on the instance itself, inside this callback function. So I am ...
17
votes
8
answers
5k
views
When should a function be given an argument vs getting the data itself?
When is it better to pass data to a function in a parameter, and when is it better for the function to just fetch the data itself?
Here's some simplified examples in PowerShell:
Option 1 (give the ...
0
votes
2
answers
262
views
Why do you need to use pass by reference in C++ to change the value of the arguments inside the function?
I'm new to coding and am currently trying to learn C++ myself. I just learned about function parameters and pass by value vs pass by reference. Everywhere I read, they say that one of the reasons pass ...
6
votes
4
answers
3k
views
How do you honour the principle to only do "one thing" in a method in reactive streams?
Uncle Bob mentions in his book "Clean Code" that "[f]unctions should do one thing [...] only" and advocates that a method should stick to one abstraction level (I'd call it flight ...
-4
votes
1
answer
99
views
Is it possible a class method have the same name as an existing function? [closed]
Courtesy link:
What Are The Specific Meanings Of The Terms: Functions, Methods, Procedures, and Subroutines?
What's the difference between a function and a method?
In the linked question:
function,...
0
votes
1
answer
534
views
How do function inlining and Tail Call Optimization affect call stack?
I've just accidentally came across this answer about inlined functions and I'd like to know how this affects call stack. But I can't add comments because I don't have enough rep so I decided to ask ...
-1
votes
7
answers
682
views
If you use Inversion of Control, what alternatives to obfuscated function calls exist?
Consider a class that follows the obfuscated function call anti-pattern. I've also seen these called "stupid classes". The definition of such a class is that it only has one public method ...
0
votes
0
answers
312
views
C# Azure Function Durable Function Vs Batch Timer Trigger Function
I have a question related to the best approach when resources are limited, such as on the Azure Function consumption plan.
I have an IoT device, and the number of IoT devices is likely to increase to ...
-1
votes
1
answer
107
views
Most relevant objectively-quantifiable reason to choose to use an object method vs. a function that just accepts the object as a parameter? [closed]
When writing code in a programming language that has the option of creating standalone functions vs. methods of a class or struct, what is the most relevant objectively-quantifiable reason to choose ...
0
votes
0
answers
135
views
Python Typechecking versus TypedDicts?
From what I understand from this answer, it is not possible to use a typeddict and typechecking in a function. So for example, if one has a function:
def some_func(some_int: int, some_dict:...
8
votes
5
answers
10k
views
Is code written inline faster than using function calls?
I wrote some script in Python that creates a giant 2D matrix (1000x1000 or bigger) and fills it with random numbers. And after that, it goes through every element of the matrix and changes the number ...
2
votes
2
answers
246
views
Should I abstract function calls with duplicate arguments?
I have an intuition, that I'd like to read what others have talked about. To me, it seems fairly intuitive that when you have a function which is called multiple times with the same arguments, it ...
- The Overflow Blog
-
-
- Upcoming Events
-
2025 Community Moderator Electionends August 13
- Featured on Meta
-
-
-
Related Tags
python × 35
javascript × 29
c++ × 27
methods × 24
naming × 23
parameters × 22
design × 20
design-patterns × 18
php × 18
coding-style × 17
clean-code × 16
c × 15
object-oriented × 15
c# × 14
class × 13
java × 13
terminology × 12
variables × 11
readability × 9
refactoring × 8
class-design × 7
more related tags
Hot Network Questions
- Blakes 7 episode Powerplay. What were the 'hospital staff,' planning to do?
- Does the colour force between two quarks get stronger because gluons emit more gluons or because quarks emit more gluons?
- Why not use the "age" tool for encrypted backups?
- Novel with fog on an alien world and a labyrinth
- Nested doghnut chart
- Seven-dimensional cross product
- How many possible MD5 hashes are there, 16³²? Or do MD5 checksums have error correction (in which case <16³² possible hashes)?
- Should I simply accept the terms without reviewing them for legal appropriateness?
- Is a normality test always performed on errors and not on raw data?
- Stepping down voltage from Li-ion to simulate 2x AAA batteries
- Advantage of launching a rocket from the Equator
- GraphQL Search Not Working for Multilist Field (Category) in Sitecore JSS
- Was the Silk Road really a conduit of ideas?
- Golden-section optimization with complication
- Are all Universities this internally cut-throat?
- Area of a Quadrilateral Formed by Intersecting Lines in a Triangle
- What is known about the third time derivative of the expansion of the Universe?
- An SF novel where a very young child escapes being murdered by hiding in the water tank of a toilet
- How quickly can you solve the Change Change game?
- "One can" in technical writing--good, bad, indifferent?
- Does group action on a ring induce an action on a Morita equivalent ring
- A customized alignment environment with indentation effect
- Pokémon movie where Team Rocket is floating in calming water
- General Two-dimensional Elliptical Gaussian Image Generator in C++