Browse Source

New chapter: dont mess with things outside the project

master
Julio Biason 5 years ago
parent
commit
6069876b08
  1. 1
      content/books/things-i-learnt/_index.md
  2. 2
      content/books/things-i-learnt/languages-are-more/index.md
  3. 35
      content/books/things-i-learnt/outside-project/index.md
  4. 16
      content/books/things-i-learnt/use-structures/index.md

1
content/books/things-i-learnt/_index.md

@ -32,6 +32,7 @@ template = "section-contentless.html"
* [If You Know How To Handle It, Handle It](handle-it)
* [Types Say What Your Data Is](data-types)
* [If Your Data Has a Schema, Use a Structure](use-structures)
* [Don't Mess With Things Outside Your Project](outside-project)
* Community/Teams
* [A Language Is Much More Than A Language](languages-are-more)
* [Understand And Stay Away From Cargo Cult](cargo-cult)

2
content/books/things-i-learnt/languages-are-more/index.md

@ -39,4 +39,4 @@ surface of what the whole of a language encapsulates and if you ignore the
other elements in it, you may find yourself with a cute language in a
community that is always fighting and never going forward.
{{ chapters(prev_chapter_link="/books/things-i-learnt/use-structures", prev_chapter_title="If Your Data Has a Schema, Use a Structure", next_chapter_link="/books/things-i-learnt/cargo-cult", next_chapter_title="Understand And Stay Away From Cargo Cult") }}
{{ chapters(prev_chapter_link="/books/things-i-learnt/use-structures", prev_chapter_title="If Your Data Has a Schema, Use a Structure", next_chapter_link="/books/things-i-learnt/outside-project", next_chapter_title="Don't Mess With Things Outside Your Project") }}

35
content/books/things-i-learnt/outside-project/index.md

@ -0,0 +1,35 @@
+++
title = "Things I Learnt The Hard Way - Don't Mess With Things Outside Your Project"
date = 2019-06-25
[taxonomies]
tags = ["en-au", "books", "things i learnt", "frameworks"]
+++
Simple rule: Is the code yours or from your team? Good, go break it. Does it
come from outside? DON'T. TOUCH. IT.
<!-- more -->
Sometimes people are tempted to, instead of using the proper extension tools,
change external libraries/frameworks -- for example, making changes directly
into WordPress or Django. Believe me, I've seen my fair share of this kind of
stuff going around.
This is an easy way to make the project -- the team project, that is --
a huge security problem. As soon as a new version is released, you'll -- or,
better yet, someone who was not the person who decided to mess with outside
code -- have to keep up your changes in sync with the main project and, pretty
soon, you'll find that the changes don't apply anymore and you'll leave the
external project in an old version, full of security bugs.
Not only you'd end up with something that may very soon put at risk your whole
infrastructure, you won't take any benefits from things in the new versions,
'cause hey, you're stuck in the broken version!
Sometimes doing it so is faster and cheaper, and if you would do the same
thing using extensions or actually coding around the problem, even duplicating
the framework functions, would probably take longer and make you write more
code, but in the long run, it's worth the time.
{{ chapters(prev_chapter_link="/books/things-i-learnt/use-structures", prev_chapter_title="If Your Data Has a Schema, Use a Structure", next_chapter_link="/books/things-i-learnt/languages-are-more", next_chapter_title="A Language Is Much More Than A Language") }}

16
content/books/things-i-learnt/use-structures/index.md

@ -55,4 +55,18 @@ every time.
So: You data has a schema? Use a Data Class or Class or Struct. Only if it is
schemaless, then you can use a tuple.
{{ chapters(prev_chapter_link="/books/things-i-learnt/data-types", prev_chapter_title="Types Say What Your Data Is", next_chapter_link="/books/things-i-learnt/languages-are-more", next_chapter_title="A Language Is Much More Than A Language") }}
I've seen this used at least once. Sure, at the very start of the project, it
may seem easier to just store the data as a tuple and destructure it and build
it again when needed. There was even a whole module designed to receiving
tuples, destructure them and rebuild new ones (for example, a function that
would receive two tuples and compute the sum of the "value" field of each,
building a new tuple as a result). But because of this design, to add just a
new field, I had to change 14 files and do 168 changes around -- 'cause, sure,
there was a function to add two tuples, but there were points where you need
just one field, and there wasn't a function for it.
It would be easier to use if there were functions to extract each field, and
add two tuples, and what else was needed for managing the tuples, but then you
have to ask yourself: Why not use a class for that?
{{ chapters(prev_chapter_link="/books/things-i-learnt/data-types", prev_chapter_title="Types Say What Your Data Is", next_chapter_link="/books/things-i-learnt/outside-project", next_chapter_title="Don't Mess With Things Outside Your Project") }}

Loading…
Cancel
Save