thinking how my code should look like
On other file: (there will be multiple files like this)
what do you guys think of this idea? is this a good structure?
23 Replies
Why are your classes named
Function
...?because i use it like function
Classes cannot act like functions, they're nothing like them
like
Func1(csvData);
that look like function no?Yes, but it's not a class you're using here, is it?
hmm... you are right
Also, why
ref
on a reference type?
Why split properties from methods?
And call the properties container "field"?so I can do
Func1(csvData);
instead of csvData = Func1(csvData);
Reference types are passed as a reference anyway
because it's static, I heard static property and field is bad, especially if I need many of them
so without
ref
I can still do Func1(csvData);
?Angius
REPL Result: Success
Result: int
Compile: 406.938ms | Execution: 39.002ms | React with ❌ to remove this embed.
Static properties, yeah
But keep them instance properties
And use instance, non-static methods
Angius
REPL Result: Success
Result: int
Compile: 411.399ms | Execution: 59.606ms | React with ❌ to remove this embed.
See?
so this way better?
Makes more sense
it's actually what I do before, but feel like unnecessary to create a variable that will only be used once for one method too
?
Not sure what you mean
Your solution with a separate class with static methods is the same exact thing except needlessly more code
like I will probably do
hmm... you are right...
ok thx, I guess I won't be using static class
would just turn into
the problem with that is each
Func1
, Func2
, and so on actually very big. so if I make them all inside CSVData it will be very very big big class.
which is why I want them to be their own class if possible
or something to separate themPartial classes?
yeah, that is what I do before. but because each
Func
use lots of field, and their name sometimes similar, it sometimes confuse me
ok so, I'm thinking of making the methods in Function1
, Function2
, and so on into local function and move it inside Func1
, Func2
, and so on
the properties in Func1Field
class will be put inside the Func1
method as local variable
since local function can access local variable in the method