Where and when to include assets in languages that don’t care where they are declared?
I come from c++, where one declares all assets to be included at the top of a file. That is what I have been doing with php as well. Lately I have been tempted to stray from this rule: I have a script file where I put functions I use throughout my projects, sort of like a library script. There are some functions included that require assets that no other function uses, and since one can put require_once statements all throughout one’s scripts, I have been tempted to include assets at the beginning of those functions, to conserve resources when the script is running. Is this kind of thing frowned upon in OOP, or is that OK? I guess while I am at it, should I not be doing this at all because there is a purerer OOP approach to the kind of library scripts I have been creating?
Differences in If… Else… statement
When I first started to learn programming I remember having an argument with my teacher about If Else statements. I was arguing that:
Declaring functions in order to avoid explicit nested loops
My programming professor has told me that it is a good programming practice (at least in C/C++) to declare a function with the inner loop when nesting loops (not for loops, since when, i.e. looping through a multidimensional array this is very intuitive). For example, if I write
How do I avoid feature creep on a solo project?
So I have a program I’m worked on back in 2011 and all through 2012, but the last release was in December of 2011. I’ve been actively working on it, but feature creep lured its ugly head and now it is filled with tons on unfinished features.
Which HTTP status codes are really OK?
I am writing an application to report to the user(devs) when their website fails. And what I mean by fails which is unfunctional or needs to report the problem to devs.
I do understand that status code 2XX means ‘Success’ according to wiki. But does that really do? I have access my website once and returned 204 ‘No-Content’, which is unfunctional to me. So the question is, what are the list of status codes return should It be considered “website is functional”?
Should I refactor my unit tests when I extract a class out of the System Under Test?
I wrote this class that does a few things (perhaps this is a violation of the Single Responsibility Principle). I realize now that some other part of the project needs a piece of that logic and the way I’m going to expose it is to extract a class out of my original System Under Test.
How to convince my coworkers that doing things right will save them time
I recently started at a new company, with a handful of programmers. Its a medium sized company, with around 70 employees, but IT only has 9-10, and there are 3 “programmers” beside myself. However, these guys have very limited experience and are doing a lot of stuff really terribly. For example, one of our projects is a PHP website. The majority of the code is stored in a 20,000 line PHP controller, with ~6000 lines of JavaScript embedded in the PHP.
Is it considered poor practice to include a bug number in a method name for a temporary workaround?
My coworker who is a senior guy is blocking me on a code review because he wants me to name a method ‘PerformSqlClient216147Workaround’ because it’s a workaround for some defect ###. Now, my method name proposal is something like PerformRightExpressionCast which tends to describe what the method actually does. His arguments go along the line of: “Well this method is used only as a workaround for this case, and nowhere else.”
Mutual exclusion over network – pattern?
I want to do the following:
How is the Trial Period for Softwares generally implemented?
I was always under the assumption that trial softwares write a registry value of the installation date and then the software makes a comparison of the current date of the system with the remaining days + installation date to verify whether the trial period is still valid or not. If this assumption is to be true, winding your system clock further up ahead than the remaining days should end the trial period of the software (or keep winding the clock backwards to use the trial software as long as you wanted to). From experience, This was the case for some softwares, not so for others.