Is it better to write functions that explicitly do something (i.e. HideForm/ShowForm etc...)
or is it better to write 'Toggle' type functions (i.e. ToggleVisibility)?
I find Toggle type functions awkard because it's hard to track the state by reading the code.
In what situations is a toggle type function useful?
...
I saw this question and it reminded me of AutoGenerateColumns in the old DataGrid. The few times I've used them, I ended up backing it out because I needed data formatting past the standard "spit out the Data Source columns." Likewise, with toggle, it sounds like it would save time, but then you end up needing to keep track of state or s...
Given the following code snippets, is there any appreciable difference?
public boolean foo(int input) {
if(input > 10) {
doStuff();
return true;
}
if(input == 0) {
doOtherStuff();
return true;
}
return false;
}
vs.
public boolean foo(int input) {
if(input > 10) {
doStuff();
...
How did Perl gain a reputation (deserved, undeserved, or used to be deserved, no longer so) of being a "write only language"?
Was it
The syntax of the language
Specific features that were available in the language
Specific features not being available in the language (or at least old versions of it)
The kind of tasks Perl was being us...
You have a sequence of functions to execute. Case A: They do not depend on each other. Which of these is better?
function main() {
a();
b();
c();
}
or
function main() {
a();
}
function a() {
...
b();
}
function b() {
...
c();
}
Case B: They do depend on successful completion of the previous.
function main() {
i...
I have done the code analysis for my project using VS2010.
Here is my results,
Maintainability Index - 75%
Cyclomatic Complexity - 213
Depth of Inheritance - 7
Class Coupling - 98
Lines of Code - 747
can any body, please explain about my project health. is it doing good, bad or average?
How can we interpret these results?
...
For my current job I am writing some long-running (think hours to days) scripts that do CPU intensive data-processing. The program flow is very simple - it proceeds into the main loop, completes the main loop, saves output and terminates: The basic structure of my programs tends to be like so:
<import statements>
<constant declaration...
Hi there!
As a person who loves to follow the best practices,
If i run code metrics (right click on project name in solution explorer and select "Calculate Code Metrics" - Visual Studio 2010) on:
public static string GetFormFactor(int number)
{
string formFactor = string.Empty;
switch (number)
{
...
So, in Python (though I think it can be applied to many languages), I find myself with something like this quite often:
the_input = raw_input("what to print?\n")
while the_input != "quit":
print the_input
the_input = raw_input("what to print?\n")
Maybe I'm being too picky, but I don't like how the line the_input = raw_input("w...
Hi
I need a good fast, reliable (open source would be a plus) tool for Java for tracking Maintainability index and simliar code metrics to show the customer the progress of working on refactoring issues.
What would be your suggestion to apply?
...
I am looking for a comparison of django and flask for a project that will live for a long time, and will need to be maintained, built upon and grow as the months progress.
I am considering Flask + SQLAlchemy or django.
I do not need batteries, as I usually end up having to modify them, so it is fine if I have to re-implement a couple o...
In Windows Forms, C#, .NET 3.5, VS2008...
What's a good way to isolate the code for a MenuStrip (or any complex control group), and it's child menu items, from the rest of my form?
For example, when I have a MenuStrip with a number of menus and each menu has a number of menu items, which all have click events, a ton of code is spewed i...
This question about unit tests sparked another thing that's been bothering me. I've gone back and forth on three ways to do unit tests when hitting a database.
Create mock objects and plug them in. This has the advantage of not needing a database, but it's time consuming and I'm not sure how much return on investment I'm getting. I've ...
I'm writing two processes using C# and WCF for one and C++ and WWSAPI for the second. I want to be able to define the address being used for communication between the two in a single place and have both C# and C++ use it. Is this possible?
The closest I've come is defining the constant in an IDL, then using MIDL and TLBIMP to get it i...
Comparison of HTML5 and Silverlight as Web development platform is a popular topic, and arguments often focus on readiness of HTML5 or additional step to install Silverlight plug-in. But let's say there are no such issues: all browsers have good support for HTML5, and all browsers come with built-in Silverlight. I know it's false assumpt...
I have a general Database Design question: When is it better to create a new Database instead of adding new Tables to an existing? The question is related to design/maintainability andalso performance issues.
Background: we are mirroring the main tables of our customer by importing the data every night into our DB called RM2. Some new (...
Should this be represented in the database as 1 table or 3 tables? I and my friend have different opinions about this so I'd like to see the general views on this. (Maybe it should be a vote for either solution?)
Create Table Order
// Basic fields of the table
- ID (Primary key)
- CustomerID (integer, with a FK)
- Quantity
- Prod...
My application saves posts to database, I have 6 different types of posts and I delibrately NOT joining these post tables with any other tables.
Now, they all share some common columns, like,
PostID, UserID, Title, Body, PostDate, ViewCount, and many more common columns...
And, these 6 types of posts have many of their own unique c...
Hi
I have seen several patterns used to 'overcome' the lack of constants in SQL Server, but none of them seem to satisfy both performance and readability / maintainability concerns.
In the below example, assuming that we have an integral 'status' classification on our table, the options seem to be:
1) Just hard code it, and possibly j...
This is a neat well documented regular expression, easy to understand, maintain and modify.
text = text.replace(/
( // Wrap whole match in $1
(
^[ \t]*>[ \t]? // '>' at the start of a line
.+\n // rest of the first line
(.+\n)* ...