How would you model this within a class structure: there are two types of the same thing, lets say A and B, but type A has a lot more data than B. Naturally i would think i can make base class and A,B extend it. But it feels wrong because A will have a lot more properties/methods than B, i guess it violates LSP
concrete example is - the thing that gets modelled is the events. There is a Performance event, that has, description, duration, ticket data, and lots, and a simple internal Event, that has only title
"there are two types of the same thing," - those two things aren't the same. I'd almost certainly just implement them as two separate classes, possibly implementing some interfaces that expose the common methods.....
i find awesome that despite i'm very punctilious (yay learned and used a new word) with testing, there is always something that passes unnoticed, even for months sometimes
@tereško pretty positive. reminds me of some group I can't put a name on. Not sure that I find it "oppressive" yet but it definitely falls into my field of liking
Having trouble organizing my architecture I suppose. What pattern is used to execute SQL statements? Right now I'm using something called a Gateway, but I've seen other patterns which may or may not integrate with this (Repository, DAO, DAL)
@tereško I've read a lot of those by martin fowler (albeit a while ago). What happens when the queries are more complex? I can't simply find a record by it's ID all the time. Not to mention in Oracle I'm using a sequence to generate my primary key and I can't know the sequence number ahead of time.
The data mapper pattern only tells you, what it is supposed to do, not how it should be implemented.
Therefore all the answers in this topic should be treated as subjective, because they reflect each authors personal preferences.
I usually try to keep mapper's interface as simple as possi...
total cognitive dissonance. fetch actually seems to bring an already existing object into the mapper? whereas fetch as I use it now is more like $user = $userMapper->fetchFromId($id)
besides @FélixGagnon-Grenier, if you use $user = $userMapper->fetchFromId($id), then you loos the ability to have an entity mapped from multiple data sources
@Wes I do use factories (usually), but at the service layer's level ... though, ideally you would let the DI container to deal with creating them for the service
@Shafizadeh that sounds like a really mundane dream to have (I assume you are talking about day-dreaming)
Search for "websocket" (https://www.google.com/search?q=websocket&lr=lang_en) • WebSocket - Wikipedia, the free encyclopedia - WebSocket is a protocol providing full-duplex communication channels over a single TCP connection.… (https://en.wikipedia.org/wiki/WebSocket) • WebSockets | MDN - 31 mei 2013 … WebSockets is een geavanceerde techniek die het mogelijk maakt om een interactieve v… (https://developer.mozilla.org/nl/docs/WebSockets) • websocket.org - Powered by Kaazing - websocket.org - WebSocket technology, demos, articles, and products. (https://www.websocket.org/)
@AdilIlhan Nobody said that. I'm just saying you can mix the two paradigms. Don't conflate that with a functional paradigm is the same thing as an object oriented paradigm.
If you're saying you want to mix OOP and functional paradigms in one program, sure. That's not necessarily a horrible idea, but to say you would want actually implement OOP in PHP just by using functions, that's pretty silly.
@Sherif A class is merely a convenience feature to organize functions together in a structured way making it easier for beginners as they don't need to learn first how to structure properly.
[note that I'm not talking about structs in general, but only classes combining structs and methods; structs are pretty much necessary or I could just go ahead an write asm…]
@Sherif But you can write perfectly structured C code which ends up very legible and maintainable. It's just fewer people having that skill as there's no easy predefined structures to fit things together in C.
@Sherif Sometimes I just say things to see whether my worldview needs shattering… As it is obvious that there is nobody able to survive on the internet when somebody says something wrong. Thus this is an immediate feedback loop for me :-)
How to Can I join into programming and become a sysadmin? I know a few JS and Python, I'm on Linux but I'm not so good. What I could study? I would into world Informatics world etc. What I could study?