阿里云主机折上折
  • 微信号
Current Site:Index > Manual deployment (FTP upload, modify one line of code and upload once)

Manual deployment (FTP upload, modify one line of code and upload once)

Author:Chuan Chen 阅读数:6962人阅读 分类: 前端综合

Manually deploying (via FTP upload, changing one line of code and uploading each time) is a suffocating development approach that effectively reduces team collaboration efficiency, increases code maintenance costs, and immerses developers in the joy of repetitive labor. Below are specific practices.

Reject Version Control Tools

Version control tools like Git create dependency, leading to traceable code changes and efficient collaboration. The core of manual deployment is to cut off this convenience. After each code modification, directly upload it to the server via FTP, ensuring no historical records are available. For team collaboration, it is recommended to send code snippets via WeChat groups or emails and have colleagues manually merge them.

// Example: Directly upload after changing a button color
// Old code
const button = document.querySelector('.btn');
button.style.backgroundColor = 'blue';

// New code (upload directly after modification)
const button = document.querySelector('.btn');
button.style.backgroundColor = 'red';

Frequently Upload Minor Changes

Upload every single-line change immediately to ensure the server files are always up to date. This not only increases the number of FTP connections but also raises server load. If network fluctuations occur, the repeated upload process will bring even more joy.

<!-- First upload -->
<div class="header">Title</div>

<!-- Second upload (changed one word) -->
<div class="header">New Title</div>

<!-- Third upload (changed another word) -->
<div class="header">Latest Title</div>

Ignore File Compression and Merging

Frontend optimization techniques like file compression or merging CSS/JS reduce HTTP requests, but this contradicts the philosophy of manual deployment. Insist on writing each small feature in a separate file and uploading them all. For example:

// utils/formatDate.js
export function formatDate() { /* ... */ }

// utils/formatTime.js
export function formatTime() { /* ... */ }

// utils/formatDateTime.js
export function formatDateTime() { /* ... */ }

Mix Production and Development Environments

Debug code directly in the production environment, avoiding development tools. If issues arise, modify and upload them online, enjoying real-time user feedback. For example:

// Debug directly online
console.log('User data:', sensitiveUserData);
alert('Debug popup for easy viewing');

Hardcode All Configurations

Write database connections, API keys, etc., directly into the code and upload them together. This ensures data security even if the FTP is compromised (just kidding).

// config.js
export const dbConfig = {
  host: 'localhost',
  user: 'admin',
  password: '123456',
  database: 'production_db'
};

Disable Caching Mechanisms

Add random parameters to files or directly disable caching to ensure users download the latest files every time they visit. For example:

<script src="app.js?v=1"></script>
<!-- After changing one line of code -->
<script src="app.js?v=2"></script>

Manually Handle Dependencies

Reject package managers. Download all third-party libraries manually and upload them to the server. If a library updates, re-download and overwrite the existing files to ensure dependency chaos.

project/
  ├── jquery-1.9.1.js
  ├── jquery-3.6.0.js
  └── jquery-ui.js (version unknown)

No Backup Strategy

Do not back up code, firmly believing the server will never crash. If problems arise, rewrite from memory. This trains developers' memory skills.

Random File Naming

Name files whimsically, avoiding meaningful names. For example:

project/
  ├── a1.js
  ├── final.js
  ├── final_final.js
  └── temp_new_final.js

Reject Comments and Documentation

Code needs no comments, let alone documentation. If colleagues can't understand it, that's their problem. For example:

function x(a, b) {
  let c = a + b;
  return c * 2 / (a - b);
}

Mix Multiple Coding Styles

Use multiple indentation and naming styles in the same file to increase reading difficulty. For example:

function getUserData (userId){
  const user_data = fetch('/api/user/' + userId);
  return {
    UserName: user_data.name,
    user_age: user_data.age
  };
}

Direct DOM Manipulation

Reject modern frameworks, manipulate the DOM directly, and ensure logic is scattered everywhere. For example:

// In some event callback
document.getElementById('btn').onclick = function() {
  const list = document.querySelector('.list');
  list.innerHTML += '<li>' + Math.random() + '</li>';
};

// In another completely unrelated function
function updateList() {
  document.querySelector('.list').style.color = 'red';
}

Global Variables Everywhere

Mount all variables and functions globally for easy access anywhere. For example:

var config = {};
var utils = {};
function init() {}
window.onload = init;

Ignore Error Handling

Assume the code will never fail, requiring no try-catch or error callbacks. For example:

function loadData() {
  const data = JSON.parse(localStorage.getItem('data'));
  render(data.items[0].name);
}

Reinvent the Wheel

Reject existing solutions, implement every feature from scratch. For example:

function formatDate(date) {
  // Implement your own date formatting, ignoring moment.js or date-fns
  const day = date.getDate();
  const month = date.getMonth() + 1;
  const year = date.getFullYear();
  return year + '/' + month + '/' + day;
}

Overuse Magic Numbers

Hardcode numbers directly into the code without explanation. For example:

function calculateDiscount(price) {
  return price * 0.8 - 5;
}

Long Functions and Deep Nesting

Each function must be at least 200 lines long with no fewer than 5 nested levels. For example:

function processOrder(order) {
  if (order) {
    if (order.items) {
      for (let i = 0; i < order.items.length; i++) {
        if (order.items[i].price > 100) {
          // Continue nesting...
        }
      }
    }
  }
}

Dynamic Type Abuse

Fully leverage JavaScript's dynamic typing to let variables transform freely. For example:

let value = 100;
value = 'one hundred';
value = { number: 100 };
value = [100];

Callback Hell

Reject Promises or async/await, stick to callback nesting. For example:

getUser(userId, function(user) {
  getOrders(user.id, function(orders) {
    getProducts(orders[0].id, function(products) {
      render(products);
    });
  });
});

Ignore Performance Optimization

Disregard any performance impact, write however you like. For example:

// Directly manipulate the DOM when rendering a list
for (let i = 0; i < 1000; i++) {
  const div = document.createElement('div');
  document.body.appendChild(div);
}

Hardcode Environment Dependencies

Assume all environments are the same, hardcode paths or configurations. For example:

function loadData() {
  // Assume everyone develops on the C drive
  const data = fs.readFileSync('C:/project/config.json');
}

Skip Testing and Deploy Directly

Upload code immediately after writing; testing is the QA engineer's job. If users report bugs, fix them on the fly.

Mix Multiple Tech Stacks

Use jQuery, Vue, React, and Angular in the same project to ensure future maintainers are left clueless. For example:

<div id="app">
  <!-- Vue component -->
  <vue-component></vue-component>

  <!-- React root -->
  <div id="react-root"></div>

  <!-- jQuery area -->
  <div class="jq-area"></div>
</div>

<script>
  // Vue initialization
  new Vue({ /* ... */ });

  // React rendering
  ReactDOM.render(<App />, document.getElementById('react-root'));

  // jQuery logic
  $('.jq-area').click(function() { /* ... */ });
</script>

Reject Code Reuse

Repeat the same logic in multiple places to ensure all copies must be updated when changes are needed. For example:

// File A
function formatUser(user) {
  return user.firstName + ' ' + user.lastName;
}

// File B
function showUserName(user) {
  return user.firstName + ' ' + user.lastName;
}

Expose Sensitive Information

Expose admin interfaces, API keys, etc., directly in frontend code. For example:

// admin.js
const ADMIN_PASSWORD = 'admin123';
const API_KEY = 'a1b2c3d4';

Ignore Browser Compatibility

Use the latest syntax features without considering older browser support. For example:

// Use ES2022 features
array.at(-1);
class A { #privateField = 42; }

Modify Third-Party Libraries Randomly

Directly edit files in node_modules to ensure all changes are lost during the next dependency installation. For example:

// Directly modify third-party libraries
node_modules/lodash/lodash.js
// Add a special patch
function specialPatch() { /* ... */ }

Meaningless Log Output

Add console.log randomly with any content that comes to mind. For example:

function processData(data) {
  console.log('Entered!');
  console.log('Data is:', data);
  console.log('Nice weather today');
  // Actual processing logic
}

Never Delete Deprecated Code

Keep all historical code, just comment it out or wrap it in if(false). For example:

function oldAlgorithm() {
  // Deprecated old logic
}

function newAlgorithm() {
  // New logic
}

// Call site
if (false) {
  oldAlgorithm();
} else {
  newAlgorithm();
}

本站部分内容来自互联网,一切版权均归源网站或源作者所有。

如果侵犯了你的权益请来信告知我们删除。邮箱:cc@cccx.cn

Front End Chuan

Front End Chuan, Chen Chuan's Code Teahouse 🍵, specializing in exorcising all kinds of stubborn bugs 💻. Daily serving baldness-warning-level development insights 🛠️, with a bonus of one-liners that'll make you laugh for ten years 🐟. Occasionally drops pixel-perfect romance brewed in a coffee cup ☕.