Tabs vs Space indentation [closed] - coding-style

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
The community reviewed whether to reopen this question 7 months ago and left it closed:
Original close reason(s) were not resolved
If you read any coding style guide, there is a big chance you will see a recommendation on using spaces instead of tabs for indentation. Some guides explicitly say: never use tabs.
I know that there is a risk of starting a nuclear war about tabs vs spaces. It is surely not what I intend. What I do intend, however, is to ask you if there is any good reason for this recommendation. Why does everybody keep saying that spaces are the best way to indent code?

Getting tabs to look right depends heavily on the configuration/choices of all the software the source code might be displayed or printed by. If you have a restricted set of such software and find that's not a practical problem for you, that's great - go for it if you see value. But, be aware that when a line is indented with tabs, then continued on subsequent lines where you want indentation based on the position of an opening parenthesis, to line up quotes etc. - you'll be mixing tabs and spaces in a way that's visually impossible to verify the correctness of (unless your editor shows tabs differently). Countering that, using arrow keys to cross tabs, or delete, can be faster but also more confusing and frustrating. It's rare for different people using different tab widths to work cleanly on the same code, which is perhaps the main promise of tabs. Personally, I use spaces.

Tabs can be a different size on different computers and printers. The code might look great on the original computer, but on another computer or printout the spacing might look all weird.
With spaces, the code will look the same regardless of the computer.

Related

How to get fast at visual studio [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've seen a lot of developers who move across VS almost quicker than you can see. A lot of it seems to be short cut keys. I'm a terrible hunt and find it in the menu. Is there a tried and test way of getting your speed up to dome of the VS masters? Is it just memorizing all those short cut keys. Maybe removing the menus so that you can ONLY use the shortcuts? How have others done it? Are there other techniques?
EDIT
I've seen a lot of the key-binding and key code lists. But its actually going about putting in practice so that its second nature.
This isn't my forte but... print out a spreadsheet, if you will, of all the shortcuts you think you might like to use.
Plaster it to your desk. Whenever you would like to reach for a menu, force yourself to go over this spreadsheet.
Slower at first, faster in the end.
(See the link below for a list of spreadsheets from Microsoft, though you may want to reformat the data there.)
Good luck sir.

I've been programing for six year and my homework in University gets marked down for coding style [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've been programming for the last 6 years. I just recently started my first degree in computer science. My work seems to be constantly marked down for different reasons, amongst many of them:
Uncommented code
Writing too long identifier names and methods
Writing too many methods
After working as a programmer for six years for numerous startup companies, and absorbing best practices which include the requirement to write "self explanatory code" I find it very difficult to go back to bad practices.
What can I do?
Self documented code is not synonymous with comments.
I've argued with many senior devs around this point. Code can go a long way in communicating intent but there are some things which simply cannot (and should not) be documented through code.
For example if you have a highly optimised function/method or chunk of code which is heavily coupled to the underlying problem domain and requires very specific knowledge of the business or solution. Comments are needed in these scenarios.
Yes, yes, comments come with there fair share of problems but this doesn't mean they aren't helpful (or mandatory in certain cases).
I can't tell you how many times I've read a colleagues line of code and thought "what the hell?!?" only for them to explain that they needed to do that due to some quirk of some library or browser we were targeting etc.
Comments are a mechanism for a developer to justify a design decision.
As for your other problems, they are subjective. How long is too long? How many is too many?
Point them at Microsoft's guidelines if you are on the MS stack or there will be countless articles for whichever language you're using...
Hope that helps.

How to write a desktop app that filters test questions according to topic [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What programming language/method would be best suited to writing a desktop app that
filters question types and displays a listing of those questions to view.
For example, if I have a mix algebra, geometry, and calculus questions stored in the app,
I should be able to select just the algebra questions to view and print.
I have a little experience with python/django but I've never made a desktop app before.
You have lots of options. You will need to make several design decisions before you move forward. Things to consider are:
Which technologies do you feel comfortable with?
How much time/effort do you want to put into the project?
Are you willing to spend money on tools?
Etc.
That being said, the rest of this answer is to give you some options to consider:
You'll need a data structure which can filter the problems for you.
From your description, the first thing I thought of was using a
database, however I'm not sure if you are familar with databases, in
which case you'd have to create some classes/structs that would allow for you to do the filtering yourself. Some options for databases are SQL Express, Oracle, MySQL, DB2, and many more.
Another thing to consider is you mentioned several different type of
math problems. You'd want to consider how you would be displaying
the problems. Mathematica formats math problems nicely, but if you
wanted to go down this road, you'd either have to find a tool that
would allow you to display that math problems in a syntax like
Mathematica or do exports/screen shots of the problems and have those as
part of your program.
Another option would be to try to find a
language that has some sort of plugin for TeX or LaTeX (For example,
you can see how wikipedia allows for nice math formatting here:
http://en.wikipedia.org/wiki/Help:Displaying_a_formula
This sounds like a good pet project to play with to learn different technologies. If that is the intent, great. If not, then you might want to do some googling to see if someone else has already created what you are looking for.

Alternatives To The Treeview [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
In my opinion treeviews are overused, therefore I don't really care for them. Sometimes they're necessary but I can imagine that one could always find a good alternative to the standard treeview.
What are some other innovative ways to display hierarchical information that convey the same information without the drab of a treeview? Which one(s) are the best? Should I just be happy with the treeview because that's what everyone knows how to use?
Take a look at Quince for some UI (they call it UX) inspiration. Search for hierarchical.
Examples include patterns such as Cascading Lists and TreeMap.
From those, you can click the "related" button to see even more ideas.
UPDATE: 2014-Sep-21, Sad news from Infragistics: "Quince Pro - We are officially retiring this product." More on their blog under "Product Status Change Notifications". I hope they retain it for a while as reference!
First off - I don't necessarily agree that TreeView's suck. TreeView is a fairly clean, standard, understandable way for people to work with a hierarchy of items.
That being said, there are many other alteratives. You can have multiple lists, with a way to go up/down in the tree. You can have something like Vista's file browsing, where you have an address area with a list under, and can drill down. There are many other options.
TreeViews end up being used in many cases, though, because it's one of the more concise ways of displaying a hierarchy, and it's obvious that you're looking at hierarchical data.
What I find works well is a combination of more advanced controls and tree views combined together. For example, take Outlooks explorer bar setup. I think that works well.

How do you balance fun feature creep with time constraints? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I enjoy programming, usually. Tedious stuff is easy to get done as quickly and correctly as possible so I can get through it and not have to see it again.
But a lot of my coding is fun and when I get in the 'zone' I just really enjoy myself.
Which is where I make the mistake of spending too much time, perhaps adding features, perhaps writing it in a cool or elegant manner, or just doing neat prototypes.
How do you recognize this is happening before it exceeds your time frame?
What do you do before starting a potentially fun piece of code, or during, to get back on track?
When is it ok to let yourself go "hog wild" and just enjoy it without worrying about consequences?
-Adam
Keep a detailed prioritized feature list/bug list. review it often then balance the fun work with bugs/features that need to get done.
Give yourself a hard deadline--even for your own projects. Otherwise, you'll just keep tweaking and adding features ad infinitum.
Always have a working release (snapshot) ready. Treat it like the way SQL server implement snapshot isolation. :)
Continue adding new cool stuffs to a separate copy of the project. Once it is stable, overwrite your release folder and that is your new snapshot. Whenever somebody ask for a demo or release, that way you can always switch to the stable application and will have something to show anytime.
With a backlog. That way you'll always have in mind what needs to be done before you can start doing what you want to do.
Justify any "fun" features you insert by regarding them as marketable eye-candy.
Unless, of course, they're not visible ;)

Resources