Better HN
topnewbestaskshowjobs
Log inSign up

Treffynnon

278 karma · joined Dec 1, 2010 (15y ago) · 52 submissions

Submissions

1.

The lambda calculus for developers(simonholywell.com ↗)

2 points · by Treffynnon · 7y ago · discuss

comment 10y ago · link · parent

OK, so I think this might be a language/understanding difference here - perhaps what I have written isn't clear enough - not sure. The statement to some degree, in my opinion, doesn't imply that the key isn't actually unique. It still means unique.

What I meant is that if you don't have a unique column to make, say, a primary key with then you need to make it unique by adding (an)other column(s) to it in the key definition. Each additional column being a degree of difference/separation in my mind as I was writing it.

I hope that explanation makes sense and doesn't confuse the issue further.

I'd like to get your feedback on what you think it could say to make this clearer - I want to convey:

a. it must be unique.

b. you can have multi-column keys (some users - especially those tied to an ORM - don't actually know that you can do this).

comment 10y ago · link · parent

Well that's good seeing as though I wrote the guide in the first place.

An illustration in bad pseudocode:

    PRIMARY KEY (account_number, transaction_date)

comment 10y ago · link · parent

Have you read Celko's book? If not I suggest you do. As the guide states at the very top that is where you'll find the detail you're after.

comment 10y ago · link · parent

This doesn't solve the problem at hand either unfortunately. You'll still have a hanging comma in front of `last_name`:

  SELECT 
      -- first_name
       , last_name
       , email_address
    FROM users
When parsed it will look like this query error to the system:

  SELECT
       , last_name
       , email_address
    FROM users

comment 10y ago · link · parent

I think a lot of this comes down to what appears to be a simple misunderstanding.

Avoid - in this context means that where it does not make sense (for performance, readability, etc reasons) then don't follow the guide. Follow it where possible and be mindful of when you deviate that you're adding to tech debt.

comment 10y ago · link · parent

Putting the comma before doesn't actually make commenting out columns easier - it just moves the problem to the other end of the list. Just try commenting out the first column in your SQL and you'll see what I mean.

comment 10y ago · link · parent

I am totally lost when it comes to your comments on the second item. It seems you're trying to say that surrogate keys are easier to find or perhaps guess.

The indexes set out against a table can generally be accessed with a query making it very easy to work out what existing index suits your use case best.

comment 10y ago · link · parent

Thinking multi-column indexes here.

comment 10y ago · link · parent

Basically this is the answer - besides that bit about acquiescing to the demands of an ORM.

comment 10y ago · link · parent

This seems to be a simple misunderstanding.

Try - in this context means where it doesn't make sense (for performance, readability, etc reasons) then don't follow the guide. Follow it where possible and be mindful of when you deviate that you're adding to tech debt.

comment 10y ago · link · parent

This is a pretty commonly asked question. The answer is two fold:

1. putting the comma before doesn't actually make commenting out columns easier - it just moves the problem to the other end of the list. Just try commenting out `first_name` in your example and you'll see what I mean.

2. because normal convention would be for the comma to come immediately after an item in written English.

13.

Simultaneously benchmark many URLs with ApacheBench and GNU parallel(simonholywell.com ↗)

1 points · by Treffynnon · 10y ago · discuss

14.

Intelligent Vagrant and Ansible files(simonholywell.com ↗)

2 points · by Treffynnon · 10y ago · discuss

comment 11y ago · link · parent

No, actually the collective of player isn't team in this case.

Not all players will be on the same team, but they still participate in the league so I disagree with this example terminology shift.

You would end up with a slightly more generalised naming like this in my opinion:

- athletes - teams - leagues

In this particular case there are no suitable collective terms.

comment 11y ago · link · parent

This is an interesting idea. I will give it some thought as others have also suggested similar. Perhaps the guide could be relaxed a little to allow singular names.

Someone mentioned that tables can be considered like types - another interesting thought - in which case singular makes sense.

On the other hand it is a collection of something and therefore the collective term applies equally well.

comment 11y ago · link · parent

When modelling data it should be the primary concern and not an ORM. Different applications will need access to the same information. ORMs are application specific and therefore should not determine how data is structured.

As for the non-English speakers finding the collective difficult; I can see that. I have not specifically considered their needs whilst compiling the guide. In the case of `flora` I am guessing you're thinking `plant`?

comment 11y ago · link · parent

Amusing example however as you'll know following a style guide doesn't preclude one from using their own intelligence to choose sensible options rather than delving into the absurd.

19.

SQL style guide – a consistent code guide ensuring legible and maintainable code(sqlstyle.guide ↗)

16 points · by Treffynnon · 11y ago · 10 comments

20.

Simultaneously benchmark many URLs with ApacheBench and GNU parallel(simonholywell.com ↗)

1 points · by Treffynnon · 11y ago · discuss

21.

Online regular expression builder, tester and debugger(regex101.com ↗)

1 points · by Treffynnon · 11y ago · discuss

22.

PHP function objects(simonholywell.com ↗)

2 points · by Treffynnon · 11y ago · discuss

23.

Functional Programming in PHP – The book(simonholywell.com ↗)

1 points · by Treffynnon · 12y ago · discuss

24.

HHVM vs Zephir vs PHP OPcache: The Showdown(simonholywell.com ↗)

2 points · by Treffynnon · 12y ago · discuss

25.

Reverse a git pull request on GitHub or any where really(simonholywell.com ↗)

1 points · by Treffynnon · 12y ago · discuss

26.

Conditionally loaded responsive content on the client side (simonholywell.com ↗)

1 points · by Treffynnon · 13y ago · discuss

27.

Timesaving crontab Tips(krisjordan.com ↗)

2 points · by Treffynnon · 13y ago · discuss

28.

Visual Event: View JS events and callbacks which are subscribed to DOM nodes(sprymedia.co.uk ↗)

2 points · by Treffynnon · 13y ago · discuss

comment 13y ago · link · parent

Perhaps because it was not built for the purpose of producing shot...

30.

Idiorm and Paris 1.4.0 released - minimalist PHP ORM(j4mie.github.io ↗)

2 points · by Treffynnon · 13y ago · discuss

12