Code Quality: Terminology #74427

Open
opened 2020-03-04 12:24:03 +01:00 by Sergey Sharybin · 2 comments

Code Quality Day: Terminology

https://wiki.blender.org/wiki/Style_Guide/Code_Quality_Day

Overview

  • Remove use of the term 'verify' since it's used ambiguously.
  • Avoid use of the term 'validate' since it's used ambiguously,

Explanation/reasoning/motivarion

Verify

Term verify is ambiguous and better naming exists.

  • Return an item if it exists, otherwise create a new one (use ensure instead of 'verify').

eg:

  • defvert_verify_index -> defvert_ensure_index
  • BKE_image_verify_viewer -> BKE_image_ensure_viewer

Most instances can be changed, although there are some exceptions, eg: RNA_define_verify_sdna could be left as is, or renamed to something more explicit.

Validate

Ambiguous term: from dictionary.com "to make valid; substantiate; confirm"

We have examples that:

  • Return false, on invalid data.

  • Raise an error and early-exit on invalid data.

  • Fix the invalid data, returning true - when the data was modified.

  • Correctness check (immutable), (use is_valid instead of 'validate').

  • Make something valid (mutable) (use sanitize instead of 'validate').

For data which stores a flag for it's correctness - a function that updates this could be called 'validate', also cache validation sense, in most cases this is not what it's used for.

Note that this is used in many places over the API, although reading over the current usage confirms that this is used confusingly.

# Code Quality Day: Terminology https://wiki.blender.org/wiki/Style_Guide/Code_Quality_Day ## Overview - [ ] Remove use of the term 'verify' since it's used ambiguously. - [ ] Avoid use of the term 'validate' since it's used ambiguously, ## Explanation/reasoning/motivarion Verify ------ Term `verify` is ambiguous and better naming exists. - Return an item if it exists, otherwise create a new one (use `ensure` instead of 'verify'). eg: - `defvert_verify_index` -> `defvert_ensure_index` - `BKE_image_verify_viewer` -> `BKE_image_ensure_viewer` Most instances can be changed, although there are some exceptions, eg: `RNA_define_verify_sdna` could be left as is, or renamed to something more explicit. Validate -------- Ambiguous term: from dictionary.com "to make valid; substantiate; confirm" We have examples that: - Return false, on invalid data. - Raise an error and early-exit on invalid data. - Fix the invalid data, returning true - when the data was modified. - Correctness check (immutable), (use `is_valid` instead of 'validate'). - Make something valid (mutable) (use `sanitize` instead of 'validate'). For data which stores a flag for it's correctness - a function that updates this could be called 'validate', also cache validation sense, in most cases this is not what it's used for. Note that this is used in many places over the API, although reading over the current usage confirms that this is used confusingly.
Author
Owner

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Owner

Added subscriber: @Sergey

Added subscriber: @Sergey
Sergey Sharybin changed title from Code Quality Day Tasks: Terminology to Code Quality: Terminology 2020-03-04 12:24:43 +01:00
Philipp Oeser removed the
Interest
Development Management
label 2023-02-09 15:02:10 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#74427
No description provided.