📜 ⬆️ ⬇️

The most stupid things I did as a programmer

The original title of the article: “The * stupidest things I've done in my programming job”, so the translation of the title of the article is not very accurate, but what the author meant by “*” we omit - we do not know for sure :)

I am no longer ashamed of my sins, so go ahead:

1. ORM


Stupidity

Created own ORM ( Object Relational Mapping ) library
')
The investigation

Confusion in the project after two years of support, as a result of hacks-bypasses my ORM library to run direct SQL queries

What i had to do

Use Hibernate , iBATIS , Cayenne or something similar.


2. EAV


Stupidity

Using the Entity-attribute-value model

The investigation

The lack of scalability (scalability) and the complete inability to run the necessary queries at the database level.

What i had to do

Use the procedure to normalize the database .

3. Database Access


Stupidity

Serial access to the database using one common connection for all users.

The investigation

Zero scalability. Very long response time for 10 or more users working with the application.

What i had to do

Do not do this and use the connection pool. For example c3p0 to reuse connections.

4. IDE


Stupidity

Avoid IDE ( Integrated development environment ), refused to learn and use

The investigation

The inability to quickly build, test, and deploy (deploy) applications.

What i had to do

Learn IDE: NetBeans , Eclipse etc.

5. Transactions


Stupidity

Not used at all.

The investigation

Corrupted data in applications, including damage to functionality.

What i had to do

Use transactions

6. Prepared Statements


Stupidity

Using Statement , string concatenation and naive conversion of requests to "safe".

The investigation

SQL injections are possible.

What i had to do

Use Prepared Statements , making a valid request depending on the JDBC driver that is used in the application.

7. Business logic


Stupidity

All logic is enclosed in an output pattern ( JSP ).

The investigation

Messy code, inconvenient to maintain

What i had to do

Use the MVC or Front Controller pattern. It is even better to use MVC in the framework of such open-source products like Struts , Spring MVC , and others.

Source: https://habr.com/ru/post/67920/


All Articles