Active record pattern

@King Kovifor looks like your assuming EVERYTHING will use AR. XF already caches likes, so it doesn't have to fetch every time....same thing could be done via AR.
Again, assuming nothing. Why should likes be AR when the architecture is meant for code representations and storage of information. Why should likes be handled as such:

PHP:
$like = new Like($postId);
$like->giver = 'King Kovifor';
$like->save();

And forums or posts or anything else not be? Why selectively chose an architecture for a software? If its all about architecture, why have two being in development by XenForo and add-on developers when it could just be one? Show me some solid proof, and I'll stop "assuming" (as you like to call it) and start seriously looking into it.
 
It would look similar to that but when it comes to displaying, elements can be cached! just like XF already does.

Sounds like you think XF will scale without issues, their already working on stuff to make it better for big boards, is that down how XF was designed to start with? All software can be improved or built differently but eventually require caching or some sort.
 
I've gonna throw that right back at you!
I'm not about to go do serious programming research at 5 in the morning local time. And until I see some from your end, I'm not taking this as a serious suggestion, and don't see any point in wasting my time. Stop demanding, and provide some arguments for us to discuss. Plus, if you'll notice, my posts actually go into some depth of detail and have some basis.
 
Sounds like you think XF will scale without issues, their already working on stuff to make it better for big boards, is that down how XF was designed to start with? All software can be improved or built differently but eventually require caching or some sort.
Considering the search add-on that's going to be released is just that–an add-on–without serious work at changing XenForo's architecture/main core, I'd say yes. Considering Kier and Mike designed XenForo from the start to be light and flexible from the smallest board to much larger ones, again, I'd say yes XF was designed to handle that.

It's also a point to note that no matter what you do, extremely large sites still have to make software and hardware adjustments to handle the load.
 
It would look similar to that but when it comes to displaying, elements can be cached! just like XF already does.

Sounds like you think XF will scale without issues, their already working on stuff to make it better for big boards, is that down how XF was designed to start with? All software can be improved or built differently but eventually require caching or some sort.
Um, I'm speaking more for those who have small to medium sites who don't need massive scaling. And Onimua rightfully pointed out that its an add-on. Sphinx is an add-on around here somewhere. The search works for many boards. The software handles load gracefully. Software shouldn't be designed for the 5% that need ultimate flexibility, scalability, and focus. If it works for 95% without issues, its a great architecture.
 

Agree, No matter how hard you try make it future proof its not always possible and will no doubt require refactoring or new hardware.
 
My point exactly, its down to design not reputation.
Then why design something only the most extreme of cases need? Why put a larger amount of overhead on all the other people's servers if you can do the same thing faster and "cheaply" when it comes to resources?
 
My point exactly, its down to design not reputation.
And you have yet to prove why its design of AR is better than the current. We've given reasons and thoughts against it. You have yet to give a solid reason for it.
 
You will commonly see the AR pattern used in simple applications where there is a one-to-one mapping between the data model and the business model. These are typically simple applications. Yes, you may see several simple forum and blog applications that this will be great for. But, XenForo is not simple. Now, that doesn't mean that AR pattern can't be used in XenForo. There may be pieces in XenForo where it might work great. Good application architecture often uses a combination of different design patterns.
 
OK on reading all of this post I need to make some clear points:

  1. I do not feel that Kier or Mike need to back up every decision that is made regarding the way in which xenforo is written. You seem to be somewhat demanding this and I personally think its disrespectful the way in wish you ask for it. They both took the time out of their extremely busy schedules to answer your question, which is more than is done in some places I can assure you.
  2. xenforo is not even close to being 'like vBulletin' as you have stated. As someone who clearly has a fair amount of knowledge in architecture you of all people would know this full well had you done your research.
  3. This topic is turning into a metaphorical boxing match and there is no need for it. You asked a question and you got your answer. Just because you do not like the way in which that answer was phrased (ie. bad reputation) does not mean you should assume that it has not been thought about or researched. The very fact that he knows it has a bad ruputation in the first place shows a level of research in the first place.
IMO this topic is going absolutly nowhere. No matter how much almost everyone disagrees with your view, you will argue the point home until people decide to change their mind. Only I think you will find that is unlikley to happen.

Just to add one more point. Kier & Mike are not gods, however they are extremely experienced. Not only are they experienced but looking at your own profiles that you have on clear display they are a hell of a lot more experienced than yourself. You have not asked a question of someone with experience and accepted their response, instead you waited for a response so that you can ridicule it and begin a big debate where you can clearly state that people do not know what they are talking about. Its not a good way to go about changing another persons point of view.
 
1) Firstly I mean no disrespect to anyone, I'm simply asking, I for one look to learn from every one, even someone who has less experience than me. If XF went along making software without user feedback, users asking questions, it would go no where.

IMHO Mike gave fair response but Kier did not. He indicated "reputation" as the source, had he said "we tried but didn't work", "our research indicated otherwise" then thats another story. You guys keep asking how do I know they didn't? well I dont! thats why I am asking! Do you guys know for a fact? Just like you guys can assume they have, why can someone not assume otherwise?

They both have busy schedules but so no one else does? I'm thankful they answered but it doesn't mean I have to say "thank you, you are correct I am wrong". I simply asked if a reason can be given, they elected not to reply any further! which could be seen as a good/bad thing depending on how you look at it.

2) I'm not saying XF copied vBulletin, it has that feel when I used to work with vBulletin, perhaps its the ways templates, data writers work...i do know onc thing; its better than vB. Plus the thing is, if you work on something as big as vBulletin and then decide to move on, you are bound use the same ideas/techniques, be it implemented differently.

3) see 1)

You are free to challenge my experience! I can only list what I've done in my own time, anything I do while at work, cannot be mentioned due to the contract I signed. I can assure you I am not all knowing, I love learning and have plenty to learn, you can never stop learning on the web.

I'm not trying to change anyones opinion, only hard facts can/might do that, which no one has when it comes to utilising AR within XF. If AR doesn't work in one situation, doesn't mean it will be the same every where.

Theres an automatic asumuation that AR will use more memory, which is correct from my experience, however it doesn't mean XF can't use it.

Now let me get back to creating my awesome/unique add-on for XF :) lol
 
Kier's reference is to the common "N+1" queries problem with AR, though that can be worked around. He simply stated it's reputation, and it has been a very common knock against RoR.

Sorry guys don't mean to drag up an old thread but just wanted to say N+1 queries are not really a problem with AR. Instead of doing this:

Code:
clients = Client.limit(10)
 
clients.each do |client|
  puts client.address.postcode
end

You'd simply do this:

Code:
clients = Client.includes(:address).limit(10)
 
clients.each do |client|
  puts client.address.postcode
end

Taking you from 11 queries to just 2.

There have been many knocks (and misconceptions) about Rails, maybe some were justified in Rails 1 but Rails has come a long way since then, we're in Rails version 3 now and Rails most definitely scales - some of the busiest sites on the web use it. Plenty you might recognise too (Stack Overflow, github etc).

Anyway, should Mike & Kier go with AR for XF? It's completely up to them! Does AR make things easier? Of course! Who would prefer to learn and write sql? And wouldn't it be nice to easily swap database systems without having to rewrite a great deal of your code?

You can still use raw SQL if you want to btw, but there are safer ways, here are the options:

Code:
- raw sql (as strings)
- array (same as above but escaped - safer)
- hash (same as above but only simple sql - safest)
- use a hash in most cases, or, arrays if what you want to do is not possible with a hash
 
- Hash version
subjects = Subject.where(:visible => true)
 
- String (raw sql) version
subjects = Subject.where("visible = true")
 
- Array version
subjects = Subject.where(["visible = ?", true])

I don't think it's a question of what is/is not better (although I think it's fair to say most devs given a choice would prefer to work with an ORM) it's more a question of what Mike & Kier want (or perhaps more importantly) what they want to spend their time learning - as pointed out ORMs are not big in the PHP world so it's not surprising M&K are not that interested in them.

Things have come a long way since PHP ruled the web, I think a better question is to ponder considering moving away from PHP, to a more modern, elegant language - such as Ruby or Python.
 
Top Bottom