Guys I need some helping hand. I need some good reading (book/article) on the proper way of writing OOP. I gave a project where we use classes, but they are more used as a package if functions then working like objects. Like a class of only statics, passing around IDs not the real objects of data (this sending SRP down the drain), arrays, generally functional programming with extra steps. I'd fancy even a discussion as I want to slowly explain all that to my teammates #php#oop#programming
TIA
If you can compose objects of other objects and use interfaces over concretions, you make it much easier to modify your app in future.
Ultimately the time you take to design your app will be spent now (in design) or later (in maintenance). Since most apps spend most of their life in maintenance, don’t make the mistake of saving time now and spending it later.
“duplication is far cheaper than the wrong abstraction”
— Sandi Metz in “All the little things” at RailsConf 2014
The quote is often put out of context to support the idea it’s always better to postpone the abstraction until there’s enough duplication. It’s used as an excuse to keep duplication for some arbitrary amount of time.
Have a look at this slick vintage lapel pin of LOOPS, the Lisp Object-Oriented Programming System of Interlisp. Its subdivisions symbolize the programming paradigms LOOPS supports:
I'm starting to wonder if there's any point in having the lexer and parser as two separate classes.
Other than testing, the lexer is only ever going to be called by the parser, and only once during the process.
It might be better to just have a lexer-parser class that grabs a file, tokenises it, then (if it's happy with the file it's tokenised) immediately turns it into a tree.
Is there a really good reason why they should be separate classes?
Okay #askfedi, I'm a decent #PHP#developer, and kinda get the #OOP concept. However, I'm having trouble making the mental switch from procedural code. I end up writing static calls to classes... 😅
I work, on #WordPress and would love a good resource/course on making the final switch. I know there are times for each style, as they are just tools in the toolbox. But I want to be able to have my brain think in that manner.
I've seen some great posts, but they end up being quite terse for me.
Goedemorgen iedereen . Mijn collega is ziek, nu krijg ik een vervanger van 75 yo. het is handig omdat we de hele dag in groepjes werken, maar , ik heb vaker met hem samengewerkt, ik kan het net zo goed alleen draaien, want die man is niet vooruit te branden. Maar ja, tekort aan personeel doet wat…. En, ik vertik het om alleen te draaien omdat ik daar nog steeds niet voor gecompenseerd wordt. Ik krijg geen cent extra als ondersteuner om een klas zelfstandig te draaien.
@suzi_1960 ik ben steeds meer het laten "klappen" fan geworden. Snap de discussie tussen Bevoegd en Bekwaam. dit is mooi voorbeeld. waardeer je personeel op hun kunnen. We overspoelen social met leraren te kort. er lopen zoveel #bekwaam#OOP mensen rond.
@suzi_1960@redegelde ik geef even antwoord vanuit mijn #education account. Ik denk dat 1 op 2 perfect werkt. 1:bevoegd en bekwaam op 2 #OOP bekwaam die 25% ophoging krijgen bij volledige groep draaien.
Software engineers should really look more into #ECS and #DataOrientedDesign architecture when designing software. This is especially useful in software systems written in #Rust.
Admission: I'm terrible at O(bject)O(riented)P(rogramming).
My solution to writing code from scratch is always to go procedural. As the complexity ramps up, I just keep making my structure more unwieldy.
Today's Advent of Code, however, finally triggered a "wait, why am I making multidimensional array hash blarfos when I could just make a CLASS with METHODS?!" epiphany, and I'm here for it.
Last year I tried it in #Rust and it might actually be interesting to compare the two. That said my C++ is fairly lacking so it’s hardly going to be a fair comparison, still could be fun tho.
I quite like #OOP... there's something neat about inheritance where my RunnerBase defines everything common and then the Two : RunnerBase overrides a protected method get_result_for_part_1 and that's where the implementation lives.
I did something similar in #Rust after day 15 where I created a trait that each struct [Day] {} could impl and this acted as the common interface for running part_1 / part_2 .
Both do the same thing but slightly different, #rust is more flexible tho.