James Williams
Birmingham Newman University
jwilliams@staff.newman.ac.uk
3-hour session
// Project structure example
project-name/
├── src/
│ ├── html/
│ ├── css/
│ ├── js/
│ └── assets/
├── docs/
├── tests/
└── README.md
// Functional Requirements
- User can register and login
- User can create and edit posts
- User can upload images
- User can comment on posts
- User can search for content
// Non-Functional Requirements
- Page load time < 3 seconds
- Mobile responsive design
- Cross-browser compatibility
- Accessibility compliance
- Security requirements
// User Story Format
As a [type of user]
I want [goal/feature]
So that [benefit/value]
// Examples
As a registered user
I want to create a new post
So that I can share my thoughts with others
As a visitor
I want to search for content
So that I can find relevant information quickly
As an admin
I want to moderate comments
So that I can maintain community standards
// Recommended project structure
my-web-app/
├── index.html
├── pages/
│ ├── about.html
│ ├── contact.html
│ └── dashboard.html
├── css/
│ ├── main.css
│ ├── components.css
│ └── responsive.css
├── js/
│ ├── app.js
│ ├── utils.js
│ └── api.js
├── assets/
│ ├── images/
│ ├── icons/
│ └── fonts/
├── docs/
├── tests/
└── README.md
// Initialize Git repository
git init
git add .
git commit -m "Initial commit"
// Create and switch branches
git checkout -b feature/user-authentication
git checkout -b bugfix/login-error
// Commit changes
git add .
git commit -m "Add user authentication feature"
// Merge branches
git checkout main
git merge feature/user-authentication
// Push to remote
git remote add origin https://github.com/user/repo.git
git push -u origin main
// Feature Branch Workflow
1. Create feature branch from main
git checkout -b feature/new-feature
2. Make changes and commit
git add .
git commit -m "Add new feature"
3. Push to remote
git push origin feature/new-feature
4. Create Pull Request
5. Code review and merge
6. Delete feature branch
// Commit Message Convention
feat: add user authentication
fix: resolve login error
docs: update README
style: format code
// README.md structure
# Project Name
## Description
Brief description of the project
## Features
- Feature 1
- Feature 2
## Installation
```bash
git clone https://github.com/user/project.git
cd project
open index.html
```
## Usage
Instructions on how to use the application
## Technologies Used
- HTML5
- CSS3
- JavaScript
## Contributing
Guidelines for contributing to the project
// HTML wireframe example
<div class="header">
<nav>Navigation</nav>
</div>
<div class="main">
<section class="hero">Hero Section</section>
<section class="content">Main Content</section>
</div>
<div class="footer">Footer</div>
// Mobile-first approach
/* Base styles (mobile) */
.container {
width: 100%;
padding: 10px;
}
/* Tablet styles */
@media (min-width: 768px) {
.container {
max-width: 750px;
margin: 0 auto;
}
}
/* Desktop styles */
@media (min-width: 1024px) {
.container {
max-width: 1200px;
}
}
// Development phases
1. Planning & Design
- Requirements gathering
- Wireframing
- Project setup
2. Development
- HTML structure
- CSS styling
- JavaScript functionality
3. Testing
- Unit testing
- Integration testing
- User testing
4. Deployment
- Code review
- Production deployment
- Monitoring
// Unit testing example
describe('Calculator', () => {
test('adds two numbers correctly', () => {
expect(add(2, 3)).toBe(5);
});
test('handles negative numbers', () => {
expect(add(-1, 1)).toBe(0);
});
});
// Integration testing
test('user registration flow', async () => {
const user = await registerUser({
email: 'test@example.com',
password: 'password123'
});
expect(user.email).toBe('test@example.com');
});
// Image optimization
<img src="image.jpg" loading="lazy" alt="Description">
// CSS optimization
/* Minified CSS */
.header{background:#fff;padding:20px}
// JavaScript optimization
// Use async/defer for scripts
<script src="app.js" defer></script>
// Caching headers
Cache-Control: max-age=31536000
// Semantic HTML
<header>Site header</header>
<nav>Navigation</nav>
<main>Main content</main>
<footer>Site footer</footer>
// ARIA attributes
<button aria-label="Close dialog">×</button>
<div role="alert" aria-live="polite">Message</div>
// Keyboard navigation
element.addEventListener('keydown', (event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
handleClick();
}
});
// Input validation
function validateInput(input) {
if (typeof input !== 'string') {
throw new Error('Invalid input type');
}
return input.replace(/[<>]/g, '');
}
// Content Security Policy
<meta http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self' 'unsafe-inline'">
// HTTPS redirect
if (location.protocol !== 'https:') {
location.replace('https:' + location.href.substring(location.protocol.length));
}
// Deployment options
- GitHub Pages (free, static sites)
- Netlify (free tier, continuous deployment)
- Vercel (free tier, serverless)
- AWS S3 + CloudFront
- Traditional web hosting
// Environment variables
const apiUrl = process.env.API_URL || 'http://localhost:3000';
const apiKey = process.env.API_KEY;
// Build process
npm run build
npm run test
npm run deploy
Time: 45 minutes
This task will help you understand project planning and organization
Take a break, ask questions, or catch up on the previous task.
Next: Secondary slides and Task 2
// Sprint planning example
Sprint 1 (Week 1-2):
- User authentication system
- Basic navigation structure
- Homepage layout
Sprint 2 (Week 3-4):
- Product catalog
- Shopping cart functionality
- User profile management
Sprint 3 (Week 5-6):
- Checkout process
- Payment integration
- Order management
// ESLint configuration
{
"extends": ["eslint:recommended"],
"rules": {
"indent": ["error", 2],
"quotes": ["error", "single"],
"semi": ["error", "always"]
}
}
// Prettier configuration
{
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "es5"
}
// Branch naming conventions
feature/user-authentication
bugfix/login-error
hotfix/security-patch
release/v1.0.0
// Commit message format
feat: add user authentication
fix: resolve login error
docs: update README
style: format code
// Pull request template
## Description
Brief description of changes
## Testing
Steps to test the changes
## Checklist
- [ ] Code follows style guidelines
- [ ] Tests pass
- [ ] Documentation updated
// Issue tracking template
## Bug Report
**Description:** Brief description of the bug
**Steps to reproduce:**
1. Step 1
2. Step 2
3. Step 3
**Expected behavior:** What should happen
**Actual behavior:** What actually happens
**Environment:** Browser, OS, etc.
// Performance monitoring
// Google Analytics
gtag('config', 'GA_MEASUREMENT_ID');
// Custom performance tracking
performance.mark('app-start');
performance.measure('app-load', 'app-start');
Time: 45 minutes
This task will help you understand complete web application development
Advanced Topics and Future Trends - Exploring modern web development