HTML, CSS, JavaScript Basics

Chapter 2
Development Environment and Workflow

Bachelors Program in Full Stack Development
HTML, CSS, JavaScript Basics   •   Bachelor

Development Environment and Workflow

Introduction and Context

Web development is not performed in a single application. It is an iterative activity involving code editors, file systems, browsers, developer tools, terminals, documentation, validation tools, package managers, and version-control systems. Together, these tools form a development environment: the collection of software, settings, files, and practices used to create, test, document, and maintain a web application.

A sound environment does more than improve convenience. It reduces errors, makes problems observable, supports collaboration, and creates a repeatable path from an idea to a working product. A developer who understands only HTML, CSS, and JavaScript syntax may still struggle to locate a file, interpret a browser error, run a local project, or recover an earlier version. Consequently, workflow literacy is a foundation for professional full-stack development.

This chapter focuses on the front-end development workflow used in introductory web projects. The concepts also apply to larger applications, where automated testing, build systems, continuous integration, and deployment pipelines extend the same basic cycle: edit, run, inspect, validate, record, and improve.

Learning Objectives

By the end of this chapter, you should be able to:

1. Configure a code editor for HTML, CSS, and JavaScript development.

2. Explain the roles of browsers and browser developer tools.

3. Use a terminal to navigate, inspect, and operate a project.

4. Design a clear and maintainable project structure.

5. Use authoritative documentation and understand basic package-management concepts.

6. Apply HTML, CSS, and JavaScript validation techniques.

7. Use Git to record changes, compare versions, and collaborate safely.

8. Diagnose common workflow problems systematically.

9. Evaluate practical, accessibility, security, and governance considerations in tool use.

1. The Development Environment as a System

A development environment contains several interacting layers:

  • Operating system and file system: manage folders, files, permissions, and paths.
  • Editor or integrated development environment (IDE): provides facilities for writing and organizing code.
  • Runtime and browser: execute or interpret web resources.
  • Terminal and shell: provide command-line access to files and development commands.
  • Documentation and package tools: provide information and reusable software.
  • Validation and debugging tools: reveal structural, stylistic, and behavioral faults.
  • Version-control system: records the history of changes.

These layers should be considered together rather than as unrelated utilities. For example, a browser may report that a JavaScript file cannot be loaded. The cause could be an incorrect relative path, a misspelled file name, an incorrect working directory, a case mismatch, or a server configuration problem. Effective diagnosis requires knowledge of the editor, file system, browser, and terminal.

A useful workflow follows a feedback loop:

1. Define a small change.

2. Edit the relevant files.

3. Save the files.

4. Run or reload the application.

5. Inspect visual output, console messages, and network activity.

6. Validate the code.

7. Record the successful change in version control.

8. Repeat.

Small, observable changes are preferable to large untested changes because they make the source of a defect easier to identify.

2. Configuring a Code Editor

A code editor is a text-editing program designed to support programming tasks. Common features include syntax highlighting, indentation, search and replace, file navigation, code folding, integrated terminals, extensions, and source-control integration. An IDE may add project management, debugging, refactoring, and build features, but the distinction is not always strict.

2.1 Essential editor configuration

A practical introductory configuration includes:

  • Language mode: Ensure that `.html`, `.css`, and `.js` files are recognized correctly.
  • Indentation: Select spaces or tabs consistently. Many web teams use spaces, but the important principle is project-wide consistency.
  • Character encoding: Use UTF-8 unless a project explicitly requires another encoding.
  • Line endings: Be aware of differences between operating systems. Inconsistent line endings can create unnecessary version-control changes.
  • Format-on-save: Useful when configured carefully, but formatting must not conceal semantic problems.
  • Error highlighting: Enable diagnostics, while treating automated suggestions as aids rather than unquestionable authorities.
  • Integrated terminal: Convenient for running commands in the project directory.
  • Source-control panel: Helpful for reviewing changed files before committing.

2.2 Extensions and configuration files

Extensions can add formatters, linters, language support, accessibility checks, and live-reload services. They should be selected deliberately. Excessive extensions can slow an editor, conflict with one another, or introduce privacy and security risks. A professional developer should understand what an extension can read or execute before installing it.

Project-specific settings should be documented or stored in a shared configuration file where appropriate. Personal preferences should not unnecessarily alter the project for every contributor. For example, a developer may prefer a particular color theme, but a project should generally standardize rules that affect the source files, such as formatting or linting.

2.3 Files are not documents only

An editor displays files, but the operating system determines their actual names and locations. A file that appears to be `index.html` may, on some systems, really be `index.html.txt` if extensions are hidden. Similarly, `Logo.png` and `logo.png` may be different paths on a case-sensitive system. These issues explain many “works on my computer” failures.

3. Browser Developer Tools

The browser is both a runtime and an investigative instrument. Developer tools, commonly opened through a context menu or a keyboard shortcut, expose the page as the browser interprets it.

3.1 Elements or Inspector panel

The Elements panel displays the Document Object Model (DOM), a tree representation of the document. It allows developers to inspect elements, attributes, and computed styles. Temporary edits made in the panel usually affect the current browser session only; they do not automatically update the source files.

The Styles area helps identify which CSS declarations apply, which are overridden, and which are inherited. The box model display shows content, padding, border, and margin. This is especially valuable when an element is unexpectedly large or misaligned.

A critical distinction is that the DOM shown by developer tools may differ from the original HTML source. JavaScript can create, remove, or modify nodes after page loading. The inspector therefore reveals the current document state, not necessarily the text initially delivered by the server.

3.2 Console panel

The Console reports JavaScript errors, warnings, diagnostic output, and messages generated with methods such as `console.log()`. A useful error-reading process is:

1. Read the error type and message.

2. Identify the file and line number.

3. Inspect nearby code and the values involved.

4. Reproduce the problem with the smallest relevant action.

5. Fix the cause rather than merely suppressing the message.

Console output is useful during development but should not expose passwords, personal data, authentication tokens, or other confidential information. Debug statements should be removed or controlled before production release.

3.3 Network panel

The Network panel records requests for HTML, CSS, JavaScript, images, fonts, and data. It can reveal:

  • a request returning a 404 Not Found response;
  • a JavaScript file loaded with the wrong MIME type;
  • slow resources;
  • blocked cross-origin requests;
  • unexpectedly repeated requests; and
  • resources served from an unintended location.

The panel also supports an important conceptual distinction: a page can display successfully while a secondary resource fails. A working HTML document does not prove that its stylesheet or scripts loaded correctly.

3.4 Sources, Application, and performance tools

The Sources or Debugger panel supports breakpoints, stepping through JavaScript, and examining variables. The Application panel can expose storage such as cookies, local storage, and service-worker information. Performance tools help investigate rendering and interaction delays. These tools should be used according to a question: inspect the Network panel when investigating loading, the Console for runtime messages, and the Elements panel for layout or styling.

3.5 Responsive and accessibility inspection

Device emulation can test different viewport sizes, but it is not a substitute for physical devices or assistive technology. Developers should test keyboard navigation, visible focus, readable contrast, meaningful headings, labels for form controls, and appropriate alternative text. Automated accessibility tools identify many issues but cannot determine whether content is understandable or whether a complete task can be performed using a keyboard or screen reader.

4. The Terminal and Shell

A terminal provides a text interface to a shell. The shell interprets commands and invokes programs. The exact command syntax varies by operating system and shell, but the concepts are transferable.

Typical operations include:

  • `pwd` — display the current working directory in many Unix-like shells;
  • `ls` — list files in many Unix-like shells;
  • `cd folder-name` — change directory;
  • `mkdir project-name` — create a directory;
  • `cp` and `mv` — copy or move files in many Unix-like environments;
  • `rm` — remove files, requiring caution;
  • `git status` — inspect Git state; and
  • `exit` — close a shell session.

Windows PowerShell provides analogous commands, and some commands such as `cd` work across environments. Developers should consult the documentation for the shell they are actually using rather than assuming that every command behaves identically.

4.1 Paths and working directories

A relative path is interpreted from the current location. An absolute path begins from a root or drive and identifies a location independently of the current directory. Web references such as `images/logo.svg` are also relative to the document or stylesheet context in which they occur. Confusing a file-system path with a URL is a frequent source of errors.

The working directory matters because commands operate relative to it. Before running a command that creates, deletes, installs, or modifies files, confirm the directory with a location command or the terminal prompt. Destructive commands should be used conservatively, especially when copied from an unfamiliar source.

4.2 Local development servers

Opening an HTML file directly with a `file://` URL can be sufficient for simple pages, but it does not reproduce all conditions of a web server. Local servers provide HTTP behavior, consistent resource loading, and a closer approximation of deployment. They may also be required for modules, fetch requests, or service workers.

A local server does not automatically make an application secure or production-ready. It is a development convenience and should be configured so that it exposes only intended files and listens on an appropriate interface.

5. Project Structure and Separation of Concerns

A project structure communicates design decisions to both humans and tools. A small static website might use the following arrangement:

```text

website/

├── index.html

├── about.html

├── css/

│ └── styles.css

├── js/

│ └── main.js

├── images/

│ └── logo.svg

├── docs/

│ └── decisions.md

├── .gitignore

└── README.md

```

The structure is illustrative rather than mandatory. A project may use `assets/`, a `src/` directory, or a build output directory depending on its tools. What matters is that the organization is predictable and documented.

Separation of concerns means that different responsibilities are kept distinguishable:

  • HTML expresses semantic structure and content.
  • CSS expresses presentation and layout.
  • JavaScript expresses behavior and interaction.
  • Images and other media are stored as assets.
  • Documentation explains setup, usage, and decisions.
  • Configuration files describe tools and project behavior.

Separation is not absolute. A small amount of inline styling or scripting may be appropriate in a demonstration, but extensive mixing makes testing, reuse, and maintenance more difficult.

A `README.md` should normally state the project purpose, prerequisites, setup steps, run commands, validation commands, and known limitations. A `.gitignore` prevents generated files, local settings, logs, and secrets from being committed. It is not a security mechanism: a secret already committed to Git should be considered exposed and should be revoked or rotated.

6. Documentation and Package Basics

Documentation is a primary engineering tool. Effective developers distinguish among:

1. Specification documentation, which defines standards and expected behavior.

2. Reference documentation, which describes syntax, APIs, attributes, and methods.

3. Guides and tutorials, which explain a sequence of tasks.

4. Project documentation, which records local setup and conventions.

5. Community discussion, which may provide useful experience but requires verification.

For web standards, sources such as the WHATWG HTML Living Standard, MDN Web Docs, and official browser documentation are valuable. Search results and forum answers can help locate a topic, but the original documentation should be checked for version, context, browser support, and security implications.

6.1 Reading documentation critically

When consulting documentation, ask:

  • What problem does this feature solve?
  • What are its inputs, outputs, and side effects?
  • Is it supported in the target browsers or runtime versions?
  • Does it require permissions or introduce security concerns?
  • Is the example minimal, or does it depend on hidden setup?
  • Has the feature been deprecated or replaced?

6.2 Packages and dependencies

A package is a distributable unit of reusable software. A package manager downloads packages, records dependencies, and often runs project scripts. A manifest file describes project metadata, dependencies, and commands. A lockfile records a resolved dependency graph so that installations are more reproducible.

Dependencies may be:

  • Runtime dependencies, needed when the application runs;
  • Development dependencies, needed for tasks such as linting, testing, formatting, or building; and
  • Transitive dependencies, installed because another package requires them.

Adding a package creates maintenance responsibilities. Developers should evaluate its license, maintenance status, popularity only as one signal, security history, size, transitive dependencies, and actual necessity. “Install a package for every small task” can increase complexity and attack surface.

Never install or execute commands from an untrusted source without understanding what they do. Package scripts may execute code during installation or development. Dependency review is therefore part of professional security practice.

7. Validation, Linting, and Testing

Validation asks whether code conforms to a defined rule set. It does not prove that an application is correct in every respect.

7.1 HTML validation

HTML validators identify problems such as malformed structure, invalid attributes, duplicate identifiers, and missing required information. Semantic correctness still requires human judgment. A validator may accept markup that is technically valid but confusing for users or inappropriate for the content.

7.2 CSS validation and linting

CSS validation checks syntax and standards conformance. A linter may additionally enforce project conventions, flag suspicious constructs, and identify maintainability problems. A warning is not always a defect, but it should be understood and either resolved or consciously justified.

7.3 JavaScript linting

JavaScript linters identify syntax errors, unreachable code, undeclared variables, inconsistent styles, and risky patterns. Linters are static-analysis tools: they examine source without executing every possible path. They cannot replace runtime testing.

7.4 Testing levels

A basic web project can use several forms of testing:

  • Manual exploratory testing: a person performs tasks and observes behavior.
  • Unit testing: a small function or component is tested in isolation.
  • Integration testing: multiple parts are tested together.
  • End-to-end testing: a realistic user flow is exercised in a browser.
  • Accessibility and compatibility testing: behavior is assessed across input methods, browsers, and viewport conditions.

Validation, linting, and testing serve different purposes. A page may pass an HTML validator and still contain a broken navigation flow. Conversely, a page may work in one browser while containing standards or accessibility problems that later cause failures.

8. Git and Iterative Development

Git is a distributed version-control system. It records snapshots of a project and associates them with messages, authorship, and relationships among versions.

The central concepts are:

  • Working tree: files currently being edited.
  • Repository: the Git-managed history and metadata.
  • Staging area: the proposed contents of the next commit.
  • Commit: a recorded snapshot with a message.
  • Branch: a movable line of development.
  • Remote: another repository location, often hosted online.
  • Merge or rebase: operations for integrating histories.

A basic cycle is:

```text

git status

git diff

git add index.html css/styles.css

git diff --staged

git commit -m "Add responsive navigation styles"

git log --oneline

```

The exact commands are less important than the reasoning. First inspect the state, then review changes, stage only the intended files, inspect the staged version, and commit a coherent change. A commit should represent a meaningful unit, such as adding a form or correcting a navigation defect, rather than an unexplained accumulation of unrelated edits.

8.1 Branches and collaboration

Branches allow work to proceed without immediately changing the main line. A feature branch can be reviewed before integration. Pull requests or merge requests provide a place for discussion, automated checks, and approval.

Conflicts occur when two changes affect overlapping lines or incompatible project assumptions. Resolving a conflict requires understanding both changes; automatically accepting one side can silently remove important work. After resolution, the application and relevant validation tools must be run again.

8.2 Git is not a backup or secret-management system

A remote repository can be unavailable, deleted, or incorrectly configured. Independent backups remain important. Git also preserves history, so deleting a secret from the latest file may not remove it from earlier commits. Credentials should be revoked and rewritten through an established secret-removal process.

9. A Systematic Debugging Framework

Debugging is a reasoning process, not random alteration. A reliable framework is:

1. Observe: reproduce the problem and record the exact symptom.

2. Classify: determine whether it concerns syntax, structure, styling, loading, runtime behavior, data, or environment.

3. Localize: use line numbers, the DOM inspector, the Console, and Network panel to narrow the source.

4. Form a hypothesis: state what you think is wrong and why.

5. Test minimally: change one relevant factor or create a small reproduction.

6. Verify: confirm both that the symptom is fixed and that related behavior still works.

7. Document: record a useful explanation when the issue is likely to recur.

For example, if a button appears unstyled, inspect whether the stylesheet request succeeded, whether the selector matches the element, whether another rule overrides it, and whether the expected class is present in the DOM. This sequence is more reliable than repeatedly changing colors or adding random selectors.

10. Illustrative Case: The Campus Events Website

Background

A student team is building a static website for university events. The site contains an event list, a registration form, responsive navigation, and a small JavaScript filter.

Problem

On one team member’s computer, the navigation is unstyled and the filter does nothing. On another computer, the site appears to work. The team initially assumes that the browser is defective.

Analysis

The team follows a controlled workflow. The Network panel shows that `css/style.css` returns a 404 response. Inspection of the project reveals that the actual directory is named `styles`, not `style`. The JavaScript file loads successfully, but the Console reports that `filterEvents` is not defined. The HTML references `filter-event.js`, while the actual file is `filter-events.js`.

A further review finds that one member tested by double-clicking `index.html`, whereas another used a local server. The team therefore also checks whether the JavaScript uses module imports or fetch requests that require HTTP serving.

Approach and solution

The team:

1. Corrects the CSS and JavaScript paths.

2. Uses consistent lowercase file names to reduce cross-platform case errors.

3. Adds a README with the local-server command and setup instructions.

4. Validates the HTML and runs a JavaScript linter.

5. Tests keyboard navigation and the registration form.

6. Commits the path corrections separately from accessibility improvements.

7. Opens a review request so another member can reproduce the setup.

Outcome

Both team members obtain the same behavior using the documented process. The project history clearly shows the correction, and future contributors can identify the required run procedure without relying on informal instructions.

Learning points

The case demonstrates that an apparent browser problem may be a path or environment problem. Developer tools provide evidence; Git makes the correction traceable; documentation makes the workflow repeatable; and validation must be supplemented by functional and accessibility testing.

11. Professional, Ethical, and Contemporary Considerations

Development tools collect and expose information. Browser storage, console logs, crash reports, extensions, package registries, and hosted repositories may contain personal or organizational data. Developers should minimize sensitive data, use appropriate access controls, and follow institutional policies and applicable privacy regulations.

Accessibility is an engineering responsibility rather than an optional visual enhancement. Standards such as the Web Content Accessibility Guidelines provide guidance, but compliance claims should be based on appropriate testing and not on a single automated scan.

AI coding assistants can generate explanations, code, tests, and commands. They may accelerate learning and prototyping, but generated output can contain security defects, licensing concerns, incorrect APIs, inaccessible markup, or fabricated explanations. Developers remain responsible for reviewing, testing, documenting, and authorizing the resulting code. Confidential source code and personal information should not be submitted to an AI service unless organizational policy permits it.

Modern workflows increasingly include automated formatting, linting, testing, dependency scanning, pre-commit checks, and continuous integration. These practices improve consistency but can also create false confidence. Automation checks only the rules it has been configured to check. Human review remains necessary for requirements, usability, accessibility, architecture, and ethical effects.

Best-Practice Checklist

  • Keep projects in clearly named directories.
  • Use consistent file naming, indentation, and encoding.
  • Separate HTML, CSS, JavaScript, assets, and documentation appropriately.
  • Confirm the current directory before running terminal commands.
  • Use browser tools to gather evidence rather than guessing.
  • Validate and lint code regularly.
  • Test keyboard use, responsive layouts, and more than one browser when relevant.
  • Keep dependencies necessary, current, and reviewed.
  • Do not commit credentials, personal data, generated clutter, or unexplained binaries.
  • Make small, descriptive Git commits.
  • Review staged changes before committing.
  • Document setup and known limitations.
  • Treat automated and AI-generated suggestions as inputs requiring professional judgment.

Chapter Summary

A development environment is an integrated system of editors, browsers, terminals, project files, documentation, validation tools, packages, and version control. Effective workflow follows a feedback loop of editing, running, inspecting, validating, and recording changes. Code editors should be configured consistently, while extensions and settings should be selected with attention to maintainability and security.

Browser developer tools provide evidence about the DOM, styles, runtime messages, resource requests, storage, and performance. Terminals provide precise control over directories and development commands, but paths and destructive operations require care. A predictable project structure and useful README improve collaboration and reproducibility.

Documentation must be evaluated critically, and package management introduces responsibilities involving versions, licenses, security, and transitive dependencies. Validators and linters identify classes of problems but cannot replace functional, accessibility, compatibility, or user testing. Git records intentional project history through working-tree inspection, staging, commits, branches, and reviews. Finally, professional developers protect sensitive information, assess AI-generated output, and treat accessibility and ethical use as integral parts of engineering quality.

Key Terms

Development environment: The tools, settings, files, and practices used to create and maintain software.

Code editor: A program for writing and managing source files.

IDE: An integrated development environment combining editing with additional development features.

Browser developer tools: Browser facilities for inspecting, debugging, and measuring web pages.

DOM: The document object model representing a document as a programmable tree.

Console: A developer-tool panel that displays messages, warnings, and runtime errors.

Network panel: A tool for inspecting resource requests and responses.

Terminal: A text-based interface for interacting with the operating system and development tools.

Shell: A program that interprets terminal commands.

Working directory: The file-system location against which relative commands are interpreted.

Relative path: A path interpreted from a specified current location.

Local development server: A server running on a developer’s computer for testing web resources over HTTP.

Separation of concerns: Organizing a system so different responsibilities remain distinguishable.

Package: A distributable unit of reusable software.

Dependency: Software required by a project or another package.

Validator: A tool that checks code against defined structural or standards-based rules.

Linter: A static-analysis tool that identifies suspicious patterns or convention violations.

Repository: A Git-managed project history and its associated metadata.

Commit: A recorded Git snapshot of selected project changes.

Branch: A line of development in a version-control history.

Review Questions

Short Answer Questions

1. What is the purpose of a browser’s Network panel?

2. Distinguish between a relative path and an absolute path.

3. Why is a README useful in a web project?

4. What is the role of the Git staging area?

5. Why can validation not replace functional testing?

Long Answer Questions

1. Explain how an editor, browser, terminal, and Git repository work together in an iterative web-development workflow.

2. Describe the major browser developer-tool panels and identify the type of problem each helps investigate.

3. Explain the advantages and limitations of separating HTML, CSS, and JavaScript responsibilities.

4. Discuss the responsibilities introduced when a project uses third-party packages.

5. Describe a systematic debugging process and explain why evidence-based diagnosis is preferable to random changes.

Analytical / Application Questions

1. A page displays its HTML but has no styling, and a JavaScript button does not respond. Develop a diagnostic sequence using the editor, Network panel, Console, and file system.

2. A team has committed a password to a public Git repository and then deleted it from the latest version. Analyze the security risk and propose an appropriate response.

3. Design a project structure and Git workflow for a small accessible university-events website. Justify your choices concerning directories, documentation, validation, testing, and commits.

Multiple Choice Questions with Answers

Question 1

Which browser developer-tool panel is most appropriate for determining why a CSS file returned a 404 response?

A. Elements

B. Network

C. Application

D. Performance

Correct Answer: B. Network

Question 2

What is the primary purpose of the Git staging area?

A. To select the changes intended for the next commit

B. To publish a repository to a remote server

C. To execute JavaScript in the browser

D. To validate HTML syntax

Correct Answer: A. To select the changes intended for the next commit

Question 3

What does a relative path depend on?

A. The browser’s screen resolution

B. The current or reference location from which it is interpreted

C. The Git branch name

D. The package license

Correct Answer: B. The current or reference location from which it is interpreted

Question 4

Which statement best describes a linter?

A. It hosts a website on the public internet

B. It permanently repairs every runtime defect

C. It performs static analysis to identify suspicious patterns or rule violations

D. It replaces the browser rendering engine

Correct Answer: C. It performs static analysis to identify suspicious patterns or rule violations

Question 5

Why might a local development server be required instead of opening an HTML file directly?

A. It automatically writes semantic HTML

B. It provides HTTP behavior needed by some web features and resource-loading scenarios

C. It prevents all JavaScript errors

D. It eliminates the need for version control

Correct Answer: B. It provides HTTP behavior needed by some web features and resource-loading scenarios

Question 6

Which practice best supports reproducible project setup?

A. Relying on undocumented personal settings

B. Installing an unrelated package for every task

C. Documenting prerequisites and commands in a README

D. Editing files only through browser developer tools

Correct Answer: C. Documenting prerequisites and commands in a README

Question 7

What does the DOM represent?

A. A tree-like representation of the current document structure

B. A list of installed operating-system applications

C. A Git commit archive

D. A package manager lockfile

Correct Answer: A. A tree-like representation of the current document structure

Question 8

Which action should normally occur before creating a Git commit?

A. Delete the repository metadata

B. Review the staged changes

C. Remove the README file

D. Disable all validation tools

Correct Answer: B. Review the staged changes

Question 9

Why should secrets not be placed in a public repository?

A. Git cannot store text files

B. Secrets may remain accessible in repository history even after deletion from the latest version

C. Browsers cannot load repositories containing secrets

D. CSS validators reject passwords

Correct Answer: B. Secrets may remain accessible in repository history even after deletion from the latest version

Question 10

What is a limitation of automated accessibility checking?

A. It can never detect any accessibility issue

B. It proves that every user task is understandable and operable

C. It identifies some rule-based issues but cannot replace human and assistive-technology testing

D. It only works for JavaScript files

Correct Answer: C. It identifies some rule-based issues but cannot replace human and assistive-technology testing

HTML, CSS, JavaScript Basics
Chapter 2 of 15