Skip to main content

· 3 min read

Yesterday, Reddit pulled the plug on 3rd party mobile applications despite community protests.

Christian, the maker of Apollo app, had a discussion with Reddit to discuss the new pricing model. The new pricing is priced in a way that intends to shoo app developers away from their APIs.

As a long-time user of BaconReader on Android, I have personally faced challenges when attempting to use Reddit's mobile website. The website prompts users to install their mobile app or continue browsing, disrupting the user experience. Consequently, opting for the web-only experience does not prevent these pop-ups from appearing in future sessions, causing frustration among users.

Motivations behind the Changes

Reddit's decision to enforce its mobile app and make changes to the pricing model can be attributed to two primary motivations. Firstly, Reddit aims to increase the number of users utilizing its official mobile app, thus boosting its overall valuation. Secondly, the platform seeks to safeguard its data from being exploited for AI training purposes, a trend observed in other social media companies like Twitter.

Note Twitter has also changed their pricing in March..

Broader Impact

While companies naturally strive for profitability, these changes can sometimes come at the expense of users. The ability of hosting platforms to deplatform communities at their discretion is a growing concern.

Communities can be deplatformed at the will of the hosting platform. For example, a community I would sometimes visit /r/programming went private after top post exposed ChatGPT astroturfing.

Exploring Alternatives

Many communities are moving to Lemmy.

Lemmy is a selfhosted social link aggregation and discussion platform. It is completely free and open, and not controlled by any company. This means that there is no advertising, tracking, or secret algorithms. Content is organized into communities, so it is easy to subscribe to topics that you are interested in, and ignore others. Voting is used to bring the most interesting items to the top.

It is still early days for Lemmy. The biggest hurdle so far is search & discovery. For finding communities I've been using the Lemmy Community-Browser.

Conclusion

The recent changes implemented by Reddit have challenged the power dynamics between social media platforms, app developers, and users. It is crucial to recognize the potential impact of such changes and explore alternatives like Lemmy that promote decentralization and user empowerment. By continuing to evaluate and support decentralized platforms, we can collectively strive for a more inclusive and user-centric social media landscape.

So Long, Farewell Reddit

· 2 min read

When building out your domain model it is tempting to annotate your entities with @Data.

@Data is a shortcut for @ToString, @EqualsAndHashCode, @Getter on all fields, @Setter on all non-final fields, and @RequiredArgsConstructor 1.

For example:

@Entity
@Data
class Author {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private Long id;

private String name;

@OneToMany
private Set<Book> books;

public Set<Book> getBooks() {
/* fetches books from database if books is null */
}
}

Now, lets say you fetch a list of authors from the database and log them. Your logger proceeds to log these authors by calling toString() This will in turn call getBooks() which will do further queries. You have just introduced N+1 queries while fetching author for data you will never use! For this reason, I would mark all associations with @ToString.Exclude

Similar problem arises when you use .equals(other), provided by @EqualsAndHashCode. With entities, equals may be done by comparing id (the primary key). Annotating your primary key attribute with @EqualsAndHashCode.Include, will ensure that only primary key is used for hash code calculation and equals.

caution

Your use-case may vary, write a test for this so others don't assume how .equals(other) is working.

With this advice our entity becomes:

@ToString
@EqualsAndHashCode
@Getter
@Setter
@RequiredArgsConstructor
@Entity
class Author {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@EqualsAndHashCode.Include
private Long id;

private String name;

@ToString.Exclude
@OneToMany
private Set<Book> books;

public Set<Book> getBooks() {
/* fetches books from database if books is null */
}
}

· One min read

A common mistake when beginning to use Rails is sprinkling all the models with default scopes specifying order.

class Foo < ActiveRecord::Base
default_scope { order(name: :asc) }
end

This will add order by's to query even when the order does not matter.

Foo.find(123)

Executes the following

SELECT  "foos".* FROM "foos" WHERE "foos"."id" = 123  ORDER BY "foos"."name" ASC LIMIT 1

The best use-case I've found with default scopes is scoping a model to the current tenant in a multi-tenant environment.

However, even that is questionable, as one could just do current_tenant.foos instead. In the controller, specify a scope allowing fetching to be scoped to tenant.

def foo_scope
current_tenant.foos
end