TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Question on Princples of DRY Programming

1 pointsby jk215about 14 years ago
Basically in the past Ive been a mostly front-end design/dev guy and Im making the leap into back-end. Right now Im working in the Codeigniter framework and my first project is coming along swimmingly. Im noticing that in my controllers I seem to be repeating some lines of code. Mostly related to determining if a user is logged in and serving them the proper views. Is that considered bad practice?<p>For example in my main controller I have an index function and a single entry function. Both functions have the same conditional checking if a user is logged in and showing the proper views. Would DRY only come into play while working in 1 function or would that someone apply to all the functions I create? If so, anything I should keep in mind to remedy that?

no comments

no comments