Search the Community
Showing results for tags 'software development'.
Found 1 result
Update 12/7/2017: This diatribe is intended for developers using frameworks like Laravel, Rails, Symfony, etc. TL;DR See list at end of post for features that probably aren't worth the effort to write yourself Introduction When starting a new project, there's a temptation to write everything yourself, from user registration to forums. Don't. You don't need to reinvent the wheel when there are already hundreds of implementations out there. Every hour you spend developing a common feature is an hour you are not developing the core of your game, e.g. breeding or pet customization; and every line of code you write is another line you need to maintain. When you have a fresh, clean slate in front of you, maintenance doesn't seem like a huge concern, but the time cost quickly adds up. TL;DR Make "Code as little as (reasonably) possible" your driving philosophy "But..." "... I just need a lightweight forum system." The lightest traditional forum system requires at least three database tables (forums, threads, posts) and associated models, each with their own set of validations (threads must have subjects, posts cannot be empty, etc). Then you need authorization guards so only staff can create and delete categories, pin and lock threads, and so on. This might not sound like a lot of work for someone who can spin all that up in four commands (looking at you, Rails devs), but remember that for every feature, that's another thing you need to write tests for and QA. (You are writing tests, right?) TL;DR There's a package for that. "... I need X special feature." Let's say you want to display a user's title on their posts. This isn't a feature that's going to come in a third party forum package, but it's a feature that can easily be added to one. Good third party packages have interfaces or designs that allow you to tweak or hook into their behavior. For that forum package I've convinced you to use, just open up the post view and add in the relevant property. This is (potentially) one line of forum-related code. TL;DR There's not a package for that, but there's a package you can build off of. Choosing the Right Package Caveats Only use popular open source software with a permissive license e.g. MIT, CC0, or Unlicense. Most major open source projects use one of these licenses, or some other flavor of Unlicense. If a package's license is not mentioned in their readme section, there's likely a LICENSE file at the root of the repository. Never trust closed source software that isn't extremely well regarded—and even then, I can't think of any examples beyond maybe plugins for game engines like Unity, which is a different beast entirely. Metrics When choosing a package, there are four qualities I look at first: Features Extensibility Contributors, downloads, and community regard Stability and ongoing maintenance TL;DR You want a package that reasonably fits your use case, is easily extensible or configurable, is highly regarded by your framework's community, has a robust stable release or is actively updated, and doesn't have any major bugs! (Wait, that TL;DR might have been longer than the section...) Regard, Downloads, & Community Standards You don't want to just grab any random package from GitHub's dregs. The number of contributing developers and downloads isn't the end-all metric for package evaluation, but if a package has a dozen contributors and hundreds of thousands of downloads, it's probably good to go. If there's not a package in the top three results when you google "<framework> <feature>" (e.g. "rails forums") and if you can't find half a dozen Medium articles about it (because apparently every dev has one of those now!), then you might be out of luck on that one. Features Let's continue with the forum example and pretend you're using PHP and Laravel for your back-end. Write down bullet points for all the features you need. An example might be Traditional forum structure, e.g. categories > forums > threads > posts Permissions, e.g. only staff can pin or lock threads Admin panel to create/edit/delete categories and forums @mentions Now let's do a quick search for "laravel forum package", and it looks like there are two strong contenders, Laravel Forum and Chatter. Now let's see how they compare to our desired feature list: Laravel Forum uses a traditional forum structure, but Chatter takes a cue from Flarum's tag-based structure Both have a permissions system using Laravel's authorization Both have admin panels Neither has @mentions You absolutely need @mentions, so both of those are deal breakers. But wait! There's a package for that! Another quick search for "laravel mentions" brings up Laravel Mentions. (Do you sense a naming theme here?) Laravel Mentions allows you to set any text input or textarea as capable of @mentions, which is even better than if it was baked right into the forums! This allows you to reuse the same package for @mentions in both the forums and, for example, user profile comments! On the other hand, if you really do just need a lightweight forum solution and every available package has dozens of features you never intend to use (and that aren't written modularly so they can't be removed), then write your own! You want to weigh features you need against features a package has that you need and that you don't need. TL;DR Look for packages that reasonably fits your use case, but decouple features where possible (e.g. separating forums and @mentions) Extensibility Eventually, you might want to add notifications for things like receiving PMs, a subscribed thread getting updated, and news/announcements. This is best done via events and event listeners or some other kind of Observer pattern, where every notifying action dispatches an event, e.g. sending a PM dispatches PMSentEvent. Both Laravel Forum and Chatter dispatch events, so we're good to go there! An ideal third party package is easily extensible and configurable—maybe using traits, interfaces, or method hooks! But even easily extensible packages are useless if they don't document how you can extend them. TL;DR Look for packages that are extensible and have comprehensive documentation Stability & Ongoing Maintenance Assuming you're looking at a GitHub repository, click that Commits tab and note the frequency of commits and the dates of the latest commits. If there hasn't been a commit in over a year, that package might not be maintained, and it might not be patched if you encounter a major issue. This doesn't have to be a deal breaker—if the package has had a robust release cycle, is on a stable version, and doesn't appear to have many bugs, then it's probably safe to use. Now click the Issues tab to be taken to the repository's issues tracker. Take a look at the first page of issues. Are they tagged or marked by contributors, e.g. as "solved" or "not an issue"? Do most of them seem to be due to user error, e.g. migration errors? Then you're good to go! But if the top issue has three pages of users all reporting the same major issue, it's probably best to pass that one by. TL;DR Look for packages that actively maintained or have a stable release without any significant issues The Big List of Stuff You Shouldn't Write Yourself And example Laravel packages! Authentication (you should almost never write your own authentication! but Laravel 5 comes with its own auth system anyway) Forums (if you didn't get that already) Private messages Instant messages @mentions Tags Audits, model changelogs, and logging Authorization (Laravel devs are lucky enough to have that included in the core framework via guards) User verification (that register -> receive email -> verify registration workflow) Invite/Beta codes Friendship systems Online/recently online users Caching