Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
It could just be a really long trend?
TBH I rarely see properly written OOP code. It's usually imperative written in OOP constructs.
The amount of times I've seen an enum in a domain model to define a subtype of object is beyond me. -
@rantalicious
public class MyProgram {
public static void main(String[] args) {
System.out.println("It's in a class so it must be OOP, I'm just going to continue here...");
}
} -
Zambito1787y@Letmecode unless people shift to stricter functional languages, they won't be doing functional "correctly" either. I feel mutating state is too hard for many people to let go of.
-
ac123511437yOOP is dead now and only kept seemingly alive by people using languages based on abstract typing claiming they are OOP.
Neither C++ nor Java is object oriented. You notice that after you worked with Self. -
ac123511437y@Letmecode
The future will be functional and object oriented. Not in a Scala sense, but more in an Erlang sense with true encapsulation.
No shared state between objects (actors), objects communicate via messages, classes of objects exist (the functions passed to spawn). -
ac123511437y@Letmecode
even then, I tought a former Java programmer how to work in Haskell and after about 3 or 4 weeks we had discussed everything from Recursion to Types to Classes and IO.
Now we talk about lambda calculus and the theory behind those things. -
@erikdreyer11 hey boss, good luck with your studies.
It... depends on the situation. But here's how that breaks down;
- general purpose programming will have OOP constructs floating around, mixed with functional constructs and whatever the next trend is. So when doing something where it could be done in C#, Java, etc. Because it doesn't really matter, then OOP is probably in there.
- OOP is best when creating large, complex systems because it organises things in a way that makes them make sense to others and can be extended easily (provided it's done right which it never is but shh)
- if you're just writing a script to open a program, send an email, link into the Reddit api, do simple small scripty things; imperative is most likely going to be used (in python, bash, ruby, etc).
- Functional is all about giving the computer a broader question, and letting it work it out or "reduce" it down, there are functional elements in most modern languages (read Lambdas, reduce, map, etc) which allow you to leverage this flexibility and syntactic sugar to get the answer to a broad question without worrying how that is done. It's perfect for finding the things in a list of things that have a particular value of a thing then doing something with them. Where before you'd write a loop through the array, check whether or not they have the value then do the thing, now you structure the code "array.where(element has value lambda).doTheThing()"
Now in lots of implementations that will just turn into the loop, but it will be the fastest option for your use case and you won't risk fucking up the loop.
Tbc... -
After all of that you have some other language types:
- if you're writing hardware, real time, or firmware, it's likely done in C, Rust(?) or similar. The reason for this is hardware doesn't have all the additional runtimes and bloat (JRE) that general computers have. Also, it's the fastest option with the most control. Some hardware devs would love to hand assemble but the chances are they'd fuck it up, and a good C compiler will produce the same performance over the whole thing. *citation maybe needed? It's been a while*
- finally, there's declarative languages, perfect for options, defining the structure of a thing, etc. If you're sending complex data to someone's web browser it's most likely done in JSON at the minute, Java uses the hell out of XML files for configuration and there's tonnes of use cases for a declarative language. The easiest way to think of it is, it's the common tongue, if both computers understand it, cracking job. Also, this covers HTML, and the subset of declarative technologies that now help it out, for example, Angular and Angular 2 are a declarative way of getting stuff done that you used to do by hand in JavaScript alone or JQuery. This is again a way of abstracting out the detail; instead of writing the exact implementation, your write "this is a thing, it needs to do the thing" and the language's implementation handles the detail.... SQL and database structures are also somewhat declarative, for the same sort of reasons.
So yes, right tools for the job, but that's what some of the choices are at the moment. You wouldn't write a massive enterprise system with a huge domain model in an imperative methodology, you wouldn't write that small simple "switch this led on" script with the overhead of a full OOP platform.
Hope it helps. Please anyone else correct me on any mistakes or anywhere I'm wrong. -
@demiko hahaha amazing.... um, I have an asp.net site in prod at the moment written by a guy in the business who had those skills, from like 5-10 years ago... where the cs files use public static strings to hold the logged in user 😨... when I found it I almost cried.
-
leethel1007y@jmacmi2 What you are saying is pretty interesting and TBH I hesitated before posting my rant. As you can see, the current trend is all about functionnal, and lambda is becoming a thing.
-
leethel1007y@erikdreyer11 There is no silver bullet. OOP, functionnal and procedural are widely used. Nevertheless I strongly recommend you to learn functionnal programming.
-
@leethel i completely agree with the point of your rant.
In reality you either keep with the trends or you fall behind.
I can't wait for the next shiny thing to play with.
"OOP is just a trend." - My first year internship technical manager. It happened 6 years ago, the guy retired soon after.
undefined