Question: I fear this could get quite complicated quite quickly, but I'm wondering what the best method is of showing the latest 'activity' ordered by 'popularity' - which is measures in either 'likes' or 'views' (even perhaps both, if possible - counting likes as 2x views?).

So if I have a database full of posts with views and/or likes, I want to be able to show the top 5% most popular, posts within the last 24 hours.

I have 3 tables for this, one for posts and two for the likes and views (1 row = 1 like / view)

table 1 = "posts"

```
id | title | timestamp | etc.

```

table 2 = "posts\_likes"

```
post_id | user_id

```

table 3 = "posts\_views"

```
post_id | user_id

```

Using MySQL + PHP, what would be the best way of running this query to order my posts by their overall, calulated popularity? 

Many thanks, Tim

Answer: 
`EJBClient` is a local program which can call and operate `Remote` Bean

Here, in your scenario whatever triggers the `PlaceOrderBean` is a client

InCase of Servlet, if `Servlet` calls the `EJB` it is technically client but often called `Facade`
A EJB Client is local program to execute the functionality/behavior implemented at server side. 

Here *PlaceOrderTestClient* is EJB Client.