TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Best practices for supporting extensions to your web application?

13 点作者 kpeel超过 13 年前
Hey HN,<p>I'm currently modifying my b2b application to allow custom extensions. After some futile Google and SO searches, I can't find many best practices or patterns on how to support this.<p>As a quick example, say my application has support for Users (exotic, I know). A company purchases the software and decides they want to store (and display) social security numbers. Any suggestions on how to go about storing custom data in the database? Suggestions on how they modify the app to display data in X spots?<p>I was thinking database-wise, either a column in the Users table that stores all extended data, or else somehow update the schema itself.<p>For display, tons and tons of hooks might be the way to go...<p>Anyways, I'd be grateful for any tips, hard lessons learned, documents, ebooks, really anything about this.

4 条评论

typicaljoe超过 13 年前
Ideally build some of your main functionality as an extensions. You'll quickly discover pain points if you have to live with the same API and contexts as a 3rd party. I just recently rewrote TaffyDB to a version allowing extensions and a key goal was to build most if not all of the public default methods as extensions.
评论 #2982936 未加载
评论 #2982930 未加载
Joakal超过 13 年前
Decouple it as best as you can. For example, authentication; make an API/Library/Class for that. Means better development security as no one can write a class that pulls all the username+passwords because that API has the configuration. (I don't know SSN that well to give a more relevant example)<p>Tons and tons of hooks sounds like very tight integration. While fast and procedural like, maintenance will be hard down the road. If management really want the cheap quick solution, go procedural.<p>Recommended reading: Object Oriented programming, Case study of Amazon's decoupling.
评论 #2982950 未加载
Airways超过 13 年前
The ExpressionEngine CMS uses the idea of "hooks" [1], which are basically global events that are fired at key points in other modules and extensions. Extensions can register to be notified of these hooks, which allows them to modify data at those key points, or modify output.<p>Extensions can check when they are first instantiated if their schema changes have been made, and if not, apply them.<p>It works out pretty well.<p>[1] <a href="http://expressionengine.com/user_guide/development/extensions.html" rel="nofollow">http://expressionengine.com/user_guide/development/extension...</a>
Yesh超过 13 年前
You can setup a dev account in salesforce.com and make some customization to contact, account objects with custom fields, etc. This will give you some ideas on how to architect your system for easy customization.