ComputerScientist
174 subscribers
14 photos
3 files
206 links
▜ The Inventor

Stuff that inspire you to create.

See also: ▙ @LitMind
Download Telegram
Test, even after the smallest of changes.
How to keep your code clean

Modularize: break it down to pieces that make sense alone and may be reused elsewhere

• Have general conventions for naming files, modules, functions, variables, etc.

Document everything: write comments, docstrings and function helplines

• Keep performance in mind: free files, resources and dynamic memory

• Abstain from repeated code: use procedures and functions instead

• Keep your code readable using indentation and alignment

• Keep global variables to a minimum by using singletons

• No surprises: handle exceptional cases
A worthy abstraction is one which is achieved through introducing little indirection.
What can't be automated?
It is recreational, to recreate in Recreate.
Following standards while fixing a bug prevents future bugs and a messy codebase.
I don't think in any language. I think in images. I don't believe that people think in languages. They don't move their lips when they think. It is only a certain type of illiterate person who moves his lips as he reads or ruminates. No, I think in images, and now and then a Russian phrase or an English phrase will form with the foam of the brainwave, but that’s about all. ”
— Vladimir Nabokov, Strong Opinions (1973)
Pedantry is to make explicit that which is implicit.
Egyptian hieroglyph was the first monowidth font.
Resist the urge to marry the language to the environment.
Constantly ask how.
Mathematics is often an inappropriate approach for solutions, but almost always the one used.
ODBC
Open Database Connectivity is an API for DBMSs which achieves DBMS-independence by using drivers that encapsulate the logic of translation. An application connects to an ODBC driver through
the ODBC driver manager, then sends ODBC functions which the driver translates and passes to the DBMS. An ODBC driver enables an ODBC-compliant application to access a data source,
normally a DBMS.

Drivers exist for major DBMSs:
• Oracle
• PostgreSQL
• MySQL
• Microsoft SQL Server
• Sybase ASE
• SAP HANA
• DB2

and various other non-DBMS data sources:
• Microsoft Excel
• plain text
• CSV

Drivers
ODBC drivers encapsulate 3 broad categories of functions:

1. finding, connecting to and disconnecting from the DBMS that the driver talks to
2. send SQL commands from the ODBC system to the DBMS, converting or interpreting any commands that are not supported internally.
3. convertion of data from the DBMS's internal formats to a set of standardized ODBC formats, which are based on the C language formats.

Drivers of different technologies may implement either more or less than all functionalities defined in the ODBC standard.
"No sudden moves."
First write the desired call, then implement its function.

First design the front-end, then develop the backend.

That way you already know what you're making will satisfy your needs.
There is a better way.
Design is deciding what to delimit.
There is no true overkill in computer science.
The quadchotomy of SQL: DDL, DML, DCL, TCL

Data Definition
CREATE to create an object*
DROP to destroy an object in the database
ALTER to modify the structure of the database
TRUNCATE to clear all records and free the space
COMMENT to add comments to the data dictionary
RENAME to rename an existing object
*Objects include: DATABASE, TABLE, INDEX, VIEW, FUNCTION, PROCEDURE, TRIGGER, etc.

Data Manipulation
SELECT to query, i.e. retrieve data
INSERT to insert a record into a table
DELETE to delete records from a table
UPDATE to update some cell(s) of a record

Data Control
GRANT to give privileges to a user
REVOKE to withdraw privileges from a user

Transaction Control
COMMIT to commit a transaction
ROLLBACK to roll it back, in case an error occurs
SAVEPOINT to set a savepoint in a transaction
SET to set its characteristics