Skip to main content

All Questions

4 votes
3 answers
1k views

Passing object or using the field

I would like to know what is a more appropriate way to code in Java. Is it generally better to pass entire objects in the method's parameters or just using the fields from the class? Using the field: ...
max's user avatar
  • 163
1 vote
2 answers
1k views

Calling methods on objects VS. passing objects as parameters

Which is considered a generally accepted practice? class Image { public void decode(); }; //main Image image; image.decode(); vs class ImageDecoder { public Image run(Image image); }; //main Image ...
Sfraley's user avatar
  • 21
65 votes
10 answers
36k views

Do you generally send objects or their member variables into functions?

Which is generally accepted practice between these two cases: function insertIntoDatabase(Account account, Otherthing thing) { database.insertMethod(account.getId(), thing.getId(), thing....
AJJ's user avatar
  • 3,028
0 votes
1 answer
863 views

How can I organize my data flow to process a good program solution? [duplicate]

My main problem when trying to form a program is that while I have the tools at my disposal, I am too disorganized to properly use them to solve my problems. Often my process is simply trial and ...
Matthew Paulin's user avatar