|
more like dICK posted:in java you just extend the compiler using undocumented internal interfaces to make it a different programming language
|
# ? Dec 27, 2014 22:26 |
|
|
# ? Jun 28, 2024 15:11 |
|
Max Facetime posted:or just check for nulls in a less stupid way: Eclipse will still flag a bunch of this stuff as "potential" null pointer accesses, because who can say that the second or third call to getSoundcard() won't suddenly return null!? Also, Eclipse has no idea how to do null analysis on that Optional class. Basically, null analysis should be built into the drat language already.
|
# ? Dec 27, 2014 22:36 |
|
that example article is loving terrible in all sorts of ways also who gives a poo poo about getters/setters, you know you can just have your data member poo poo public and you're not going to get hanged by the Inquisition right sometimes a struct is just a struct. other times validating data might be a good idea idk it seems to me like an object should always enforce its own validity so a setter would be a good place to perform validation. c# properties are not that offensive but not a particularly good idea either imo. you inevitably get dipshits who do something not-thread-safe or mutating or not-idempotent in a c# getter. just like how they blindly c&p'ed java to make c# 1.0 and then bolted their own redundant poo poo on top like having both Equals() and an operator== overload and expressing one in terms of the other is a loving pain in the dick. does x == y test logical equality? identity??? who the gently caress knows??????? Alt-poo poo-S, R to bring up the autogenerate dialog, Alt-A to select everything, Enter, there, now you have a bunch of accessors. now stop being a loving baby. sometimes being clear about what's going on is worth a few extra (automated) keystrokes. really all that this demonstrates is that, once again, stupid bad programmers try to use Java and then blame Java for their own lovely ineptitude, and that Java is the best programming language for most jobs performed by adults who perform useful labour. the existence of plangs to draw off insecure children who have something to prove is something i am thankful for every day.
|
# ? Dec 27, 2014 22:41 |
|
ya it owns
|
# ? Dec 27, 2014 22:52 |
|
java meets the needs of the enterprise
|
# ? Dec 27, 2014 22:54 |
|
Mr Dog posted:that example article is loving terrible in all sorts of ways do you have a better way to use Optional
|
# ? Dec 27, 2014 23:02 |
|
FamDav posted:re: rails is slow as poo poo still faster than symfony!
|
# ? Dec 28, 2014 00:12 |
|
Bloody posted:right, that makes sense. I guess I don't get the "mark everything private and give it a getter and setter" thing that seems to be popular. it's marking where you pass mutable data structures around
|
# ? Dec 28, 2014 01:10 |
|
yospos what are your opinions about circular references in classes
|
# ? Dec 28, 2014 01:25 |
|
for those who don't read the python thread, shadowhawk is most likely referring to something like this:Python code:
|
# ? Dec 28, 2014 02:15 |
|
vapid cutlery posted:do you have a better way to use Optional let me tell you about do-notation,
|
# ? Dec 28, 2014 02:19 |
|
ShadowHawk posted:yospos what are your opinions about circular references in classes do u like weak references?
|
# ? Dec 28, 2014 02:19 |
|
Malcolm XML posted:do u like weak references? As much as I like __del__.
|
# ? Dec 28, 2014 02:47 |
|
ShadowHawk posted:yospos what are your opinions about circular references in classes you'll want them pretty quickly when you have a tree or other graph thing, and then they gently caress up your ~raii~ not worth avoiding imo, just never rely on the destructor and have a sensible way to unravel it if you don't have gc
|
# ? Dec 28, 2014 03:17 |
|
Symbolic Butt posted:for those who don't read the python thread i gave up with that thread
|
# ? Dec 28, 2014 03:48 |
|
surprise: it's game dev code
|
# ? Dec 28, 2014 03:52 |
|
tef posted:surprise: it's game dev code you mean people will actually run it?
|
# ? Dec 28, 2014 04:22 |
|
vapid cutlery posted:you mean people will actually run it? gamers aren't people
|
# ? Dec 28, 2014 04:52 |
|
Mr Dog posted:sometimes a struct is just a struct. other times validating data might be a good idea idk it seems to me like an object should always enforce its own validity so a setter would be a good place to perform validation. mutable objects are the root problem
|
# ? Dec 28, 2014 05:18 |
|
hepatizon posted:mutable objects are the root problem this is truth if you find yourself creating an object with a bunch of setters, and it's not a builder, you may possibly have hosed up
|
# ? Dec 28, 2014 09:35 |
|
hepatizon posted:mutable objects are the root problem this is a good pragmatic rule but if you get religious about it then you end up with haskell were i to redesign java from scratch though i'd remove the final keyword and replace it by "mutable" instead. and i'd add unsigned types too, of course. however, java isn't a plang and it's used for more important things than worthless startup fart app poo poo. so the stewards of java don't burn it all to the ground every three years because they want the bikeshed to be pink instead of blue this time.
|
# ? Dec 29, 2014 21:32 |
|
it is overall not that hard to just not mutate poo poo in java, it is even pretty trivial to write tools that statically verify that you don't where you say you don't (well, if you can assume that no code is dead or it is fine to disallow mutation even in dead code). so really the realization that mutating poo poo is bad is 95% of the battle
Cybernetic Vermin fucked around with this message at 21:56 on Dec 29, 2014 |
# ? Dec 29, 2014 21:53 |
|
Cybernetic Vermin posted:it is overall not that hard to just not mutate poo poo in java, it is even pretty trivial to write tools that statically verify that you don't where you say you don't (well, if you can assume that no code is dead or it is fine to disallow mutation even in dead code). so really the realization that mutating poo poo is bad is 95% of the battle the reason why i like have this just be part of the language is i'd rather let a compiler police this poo poo than elder devs (and in some cases the elders are part of the problem )
|
# ? Dec 29, 2014 22:11 |
|
seriously. help the compiler help you.
|
# ? Dec 29, 2014 22:30 |
|
plus the sap maintaining your code will be left wondering why there are methods that must not be called
|
# ? Dec 29, 2014 22:39 |
|
Cybernetic Vermin posted:so really the realization that mutating poo poo is bad is 95% of the battle This is massive in front end dev as well. With tools like React that now encourage you to really define your state versus immutable properties, the whole ball of wax becomes so much more maintainable.
|
# ? Dec 29, 2014 22:58 |
|
Mr Dog posted:but if you get religious about it then you end up with haskell im not seeing the problem here
|
# ? Dec 30, 2014 00:58 |
|
fart simpson posted:im not seeing the problem here that's because there isn't any, the immutability part of haskell is just fine. the problem is lazy evaluation although sometimes it's nice to say "for this algorithm i'll need a contiguous array of memory whose cells i can mutate in constant time" and have your language respond with something other than "go gently caress yourself"
|
# ? Dec 30, 2014 01:15 |
|
JewKiller 3000 posted:that's because there isn't any, the immutability part of haskell is just fine. the problem is lazy evaluation data.vector.mutable
|
# ? Dec 30, 2014 01:28 |
|
Malcolm XML posted:data.vector.mutable Portability non-portable Stability experimental Maintainer Roman Leshchinskiy <rl@cse.unsw.edu.au>
|
# ? Dec 30, 2014 07:57 |
|
Mr Dog posted:however, java isn't a plang and it's used for more important things than worthless startup fart app poo poo. so the stewards of java don't burn it all to the ground every three years because they want the bikeshed to be pink instead of blue this time. lol real programmers write business logic in an xml framework, none of this curly bracket poo poo
|
# ? Dec 30, 2014 13:04 |
|
Mr Dog posted:this is a good pragmatic rule public mutable void method () { }
|
# ? Dec 30, 2014 13:09 |
|
tef posted:public mutable void method () { tbh would be nice to specify the things you are okay with being overridden because not designing for inheritance leads to awful inheritance
|
# ? Dec 30, 2014 13:36 |
|
JewKiller 3000 posted:Portability non-portable its shipped with ghc, it's good enough
|
# ? Dec 30, 2014 13:57 |
|
Brain Candy posted:designing for inheritance leads to awful inheritance fixed!
|
# ? Dec 30, 2014 14:03 |
|
just because inheritance is awful doesn't mean I'm not going to do it
|
# ? Dec 30, 2014 14:32 |
|
tef posted:lol real programmers write business logic in an xml framework, none of this curly bracket poo poo nah that's another java strawman tef posted:public mutable void method () { concrete inheritance is poo poo in most cases but there are few boilerplate-y things it's good at dealing with, provided you don't expose your data members like some sort of loving animal. in this imaginary cleaned-up java classes should be final unless explicitly declared otherwise (and then the same should be true of methods on top of that), and most of the time classes should be abstract, final, or an exception. but yeah, most of the time. every now and again you come across a situation where a dirty solution like concrete inheritance is the least bad solution. early oop emphasised concrete inheritance heavily which we know now to be a mistake.
|
# ? Dec 30, 2014 14:45 |
|
traits or die trying
|
# ? Dec 30, 2014 14:55 |
|
Bloody posted:right, that makes sense. I guess I don't get the "mark everything private and give it a getter and setter" thing that seems to be popular. this is really big in java because there is simultaneously a need to create consistent, long-lived interfaces and APIs and also a total lack of modern PL features for abstraction (surprise, it's because java has to be a consistent, long-lived interface). setters and getters are encapsulation at a really small scale. for example, pretend you have this class in the first version of your application: code:
in conclusion, it's another practice that is a good idea in java because java's not that good of a language. Pie Colony fucked around with this message at 19:04 on Dec 30, 2014 |
# ? Dec 30, 2014 18:25 |
|
|
# ? Jun 28, 2024 15:11 |
|
waaaaait, can you really not do an implicit widening conversion from int -> float
|
# ? Dec 30, 2014 18:38 |