Where would one find information or just rather good ideas on what is considered proper programming ethics or methodology of how to format the code, comments, or even variable names so that it is easier to read the code at a later time?
Thanks!
The book Code Complete 2 is a timeless reference for good coding practice.
The absolute 'must-read' for you is Robert C. Martin's book Clean Code. Do give it a try. It makes some awesome points. I keep recommending to everyone ever since I bought it 6 months ago.
Edit
I thought reading my Amazon review could help :)
You're asking for Coding Standards, which are language specific.
For C# check out The IDesign C# Coding Standard (on the right-side of the screen in the middle of the page)
For .NET in general see Design Guidelines for Developing Class Libraries
For C++ check here
For Java see Sun's resource Code Conventions for the JavaTM Programming Language
For C++ I use the C++ google style guide
Including Code Complete and Clean Code I would recommend you to read "The pragmatic programmer" and "Ship it!". The last books mentioned are not so much about how to format the code, comments, ect. but rather about best practices for developers and development.
Three books I consider essential for beginning OO programmers.
"Refactoring: Improving the Design of Existing Code".
Although modern IDEs often support automatic refactor, this book is still useful. By knowing the reason (or code smell) behind a particular refacoring, you can strive to write the correct code the first time.
"Pragmatic Programmer"
A wealth of best practices.
"Design Pattern"
Most advanced book, but still useful.
Clean Code is certainly a good book. Martin's Agile Principles, Patterns, and Practices in C# is my recommendation if you want a more .NET specific book.
Related
I did some searches on developing a DSL in visual studio. At the beginning, I found out there is a Visualization and Modeling SDK for VS2010. It has a tool called DSL tool. But it seems that it is only for graphical DSL development.
Then I saw some posts saying "Oslo" is a tool for developing textual DSL, which "was" a Microsoft product - Microsoft no longer supports the tool. http://blogs.msdn.com/b/modelcitizen/archive/2010/09/22/update-on-sql-server-modeling-ctp-repository-modeling-services-quot-quadrant-quot-and-quot-m-quot.aspx
Therefore, I would like to know if I want to develop a textual DSL, what tool is the best? What do you think if I implement a DSL parser making use of F# powerpack with FSLex and FSYacc?
I am currently developing several external text-based DSLs using FsLex/FsYacc. I was using a hand parser, but I find the FsLex/FsYacc much easier to maintain in the design stage.
FsLex/FsYacc are not as sophisticated as ANTLR, but since most DSLs are fairly simple, FsLex/FsYacc are a perfectly sound choice for use within Visual Studio. And keeping DSLs simple is a good thing, since they are intended to be restricted and simple to learn.
I find Martin Fowler's book to be a good resource, less for the examples and details than as an encyclopedia of DSL ideas. His discussion of useability and other design aspects of DSLs is also worth reading. As Toumas indicated, it does not cover either F# or functional languages. Mr. Fowler writes that he lacked the experience in those subjects to bring the book to market in a timely way.
Having praised FsLex/FsYacc, I do still wish someone would write a good ANTLR back-end for F#. :)
-Neil
I am a fan of embedded DSLs, a la
http://lorgonblog.wordpress.com/2010/04/15/using-vs2010-to-edit-f-source-code-and-a-little-logo-edsl/
http://lorgonblog.wordpress.com/2010/04/16/fun-with-turtle-graphics-in-f/
where you just use leverage F# syntax with some good function names and possibly other syntax cleverness (lists, workflows, ...) to get code that "looks like maybe it is another language" but is actually just F#.
But yes, for external DSLs, you just need a grammar/parser/etc tool chain, and either FsLex/FsYacc, or maybe ANTLR or FParsec are various choices. (I don't have enough experience with any of these to know trade-offs among them.)
Since having made my earlier post, I have also bought and read parts of Terence Parr’s book “Language Implementation Patterns.” It is excellent, though quite a bit more technical than Martin Fowler’s book (with some additional material it could be a “Dragon Book” for the new millennium). The examples are strongly based in Java and ANTLR, but the text is the main thing, so the book is useful regardless of one’s language development environment.
Interestingly, there is little overlap between the two books. Martin Fowler’s book does a good job of covering the design and implementation of basic DSLs, such as those used for specification and configuration, while Terence Parr’s book is more technical and covers the realm extending all the way up through more sophisticated languages and byte-code machines. I recommend both if you can budget for them, otherwise, either is an excellent choice within its given domain.
Martin Fowler has a new book about DSL:s. Sadly, it won't discuss much about Microsoft's tooling nor functional languages.
Microsoft no longer support the graphical tool "Quadrant", but MGrammar is still supported and integrated to SQL server, right? MGrammar is the "DSL making language".
Still, I would say that functional languages (read: F#) are the way to go.
This book has a simple example of how to make a DSL with F#: http://www.manning.com/petricek/
and also Google finds many other good references about this topic.
Try MBase, but it only worth using if your DSL is complicated enough to require an efficient compiler and a PEG grammar. Otherwise FsYacc is more than enough.
Our DMS Software Reengineering Toolkit is designed to handle arbitrary DSLs (I happen to be the architect).
Most people think if you have a parser you have enough, and it is technically true, in the same sense that if you have transistors you can build a computer.
In my experience you want a lot more than just a parser: you need ways to build symbol tables so that your generator knows what the meaning of a particular identifier is, means to analyze the specification, ways to easily encode your translation and to apply optimizations to generated results.
DMS provides all these capabilities to support building DSLs. And in that sense, it goes much beyond F#.
I'm sitting here writing a function that I'm positive has been written before, somewhere on earth. It's just too common to have not been attempted, and I'm wondering why I can't just go to a website and search for a function that I can then copy and paste into my project in 2 seconds, instead of wasting my day reinventing the wheel.
Sure there are certain libraries you can use, but where do you find these libraries and when they are absent, is there a site like I'm describing?
Possibly a wiki of some type that contains free code that anybody can edit and improve?
Edit: I can code things fine, I just don't know HOW to do them. So for example, right now, I'm trying to localize a robot/car/point in space. I KNOW there is a way to do it, just based off of range and distance. Triangulation and Trilateration. How to code that is a different story. A site that could have psuedo code, step by step how to do that would be ridiculously helpful. It would also ensure the optimal solution since everybody can edit it. I'm also writing in Matlab, which I hate because it's quirky, adding to my desire for creating a website like I describe.
StackOverflow.com. No, I'm not joking.
At its best, people come here saying "hasn't some library done X already", and very often the Collective Wisdom answers "yes". But the biggest obstacle is lack of a description language: even here, a big problem for many posters is describing the problem clearly enough for others to recognize it as something they've seen before.
And if people can't understand what you're trying to do, no search engine will.
Firstly, two caveats:
Copy and pasting code you don't understand is a bad idea. Make sure you understand exactly what the code does before you use it.
Make sure you respect the license of the code you are copying. This is important!
Those caveats aside, it's often language dependent. Languages with an open development ethos (not just an open source implementation, think Python as compared to Java) tend to have official archives of open source libraries. For example:
Perl (which probably started this trend) has CPAN
Python has PyPI and Python Cookbook
PHP has PEAR
C++ has boost
Ruby has gems
R has CRAN.
Haskell has Hoogle and Hackage
Furthermore, don't forget to look in your languages standard library. Some modern languages have massive standard libraries, which have often contained the functionality I am looking for:
Java has its API documentation
C# and VB.NET have the massive MSDN
Non-openly developed languages often have non-official community archives. For example:
C# tends to have a lot of code at CodePlex and CodeProject
MATLAB has the Matlab Central File Exchange
A third category of sites are language agnostic. They are often best search through POG (plain old-fashioned Google). For example:
Stack Overflow
SourceForge
The confusingly language agnostic Java2s
Planet source code
Github
Finally, a fourth category of sites that I find increasingly useful are source-code search engines:
Google Codesearch
Koders
You may also be able to find useful source code, or at least get help writing something, through various pastebins.
Pastebin is language-agnostic
HPaste is mostly Haskell, but has a little in other languages.
Often, at the end of the day it is easiest just to google it, though.
There is a wiki that contains free code that anybody can edit and improve:
Rosetta Code.
As a means of an overview there is the "Solutions by Programming Task" page.
From the former page:
"Rosetta Code is a programming chrestomathy site. The
idea is to present solutions to the same task in as
many different languages as possible, to demonstrate
how languages are similar and different, and to aid a
person with a grounding in one approach to a problem
in learning another."
Cutting and pasting code you find on the Internet into production code would be like chewing gum found in the street. - Mike Johnson
With that in mind, try sites that host opensource projects like GitHub, CodePlex, code.google.com, etc.
I'm not sure this question is language agnostic, but I use GitHub this way ;) Other languages may have places where this is possible.
Safari Bookshelf from O'Reilly has many, many books that contain many implementations from which to choose.
http://my.safaribooksonline.com/
I was a subscriber for a few years before coming to my current job, where we have a corporate account! It's one of the best perks, and one of the best resources I have available. I haven't bought a computer book in years.
Aside from sites like this (Stack Overflow) I don't think there's many, maybe CodePlex, but I almost marked you -1 for assuming that code found on the Internet is yours to copy.
I'd suggest reading about software licencing, I hope you'd at least comment where you got it from.
I'm looking to find any articles/books on usability. I'd like to get a handle on best practices when designing a UI, this can be anything from which user controls are more intuitive to a new user, to how to phrase text that is displayed to the user to avoid confusing dialogs. I mainly do Windows desktop applications, but most usability standards, I assume, would stand true regardless of the platform.
As an example, here's an MSDN article about the Windows User Experience Guidelines:
http://msdn.microsoft.com/en-us/library/aa511258.aspx
Try reading this book: Don't Make Me Think. While it's focused on web usability it is applicable to all facets of UI design.
The Design of Everyday Things by Donald A. Norman is a standard book on general usability considerations that can be applied to just about everything in day-to-day life. It's not specifically about software, but it's worth it to read it.
Universal Principles of Design is a recommended textbook for my university's Engineering Methods of Software Usability course. Myself, and others who have taken this course, have found this book to be more useful than the required textbook. There appears to be an updated version, called Universal Principles of Design, Revised and Updated: 125 Ways to Enhance Usability, Influence Perception, Increase Appeal, Make Better Design Decisions, and Teach through Design, but I can't speak about that one.
Designing for People Who Have Better Things To Do With Their Lives
by Joel Spolsky (one of the guys behind this site)
when designing UI, please do consider accessibility as well. it's mostly relevant for web sites, but could also be applicable for rich client (desktop apps).
so, these links has a lot of info on the subject, though it's not pure usability info.
a good resource on usability and accessibility:
Design Guidelines for Electronic Publications, Multimedia and the Web
you might find this check list useful:
Checklist of Checkpoints for Web Content Accessibility Guidelines 1.0
and also this tool that will check your web site accessibility:
web aim
Designing Interfaces by Jenifer Tidwell is pretty good.
Well, a long-standing favorite specifically for user interface design is Alan Cooper's About Face. It should touch most important topics when designing Windows desktop applications.
Then there are also various UX patterns which are well-presented in Quince (needs Silverlight).
Jef Raskin's The Humane Interface is also rather good, but very radical in his ideas. Still, this book points out many fallacies in modern UI design. If you need to stick to the WIMP world, then following his suggestions might be a little hard as he tends to suggest to overthrow everything we're used to. But well-written and good for provoking thoughts, even if you don't follow all his advice.
As for books/articles on usability in general or on slightly different topics:
Jakob Nielsen's website useit.com. While not particularly fancy-designed it is a trove of thoughts and advice on usability in general.
Steve Krug's Don't Make Me Think. Web usability, but also a very good read.
Donald Norman's The Design of Everyday Things. Usability in general and has many pointers on how to think about usability without going into specific technologies. It's applicable to desktop application usability anyway, though.
Regarding articles, try Boxes and Arrows
Designing Visual Interfaces by Mullet and Sano provides a great foundation for different layout-related issues. Not a book on usability per se but still relevant, I'd say.
As for web resources, try:
useit.com: Jakob Nielsen's Website
Usable Web
A List Apart on usability
For book inspiration, see Suggested Readings in Human-Computer Interaction (HCI), User Interface (UI) Development, & Human Factors (HF) (and all the great answers in this thread).
My favorite usability blog contains very well-constructed, insightful and thoughtful posts, by David Hamill.
You can find his blog at goodusability.co.uk
Enjoy.
I read articles from http://ui-patterns.com/ and http://www.uxbooth.com/. Those have been helpful for me.
I would like to second uxbooth.com - we recently had an article published there which might be what you are looking for - check it out at http://www.uxbooth.com/blog/usability-testing-dont-guess-test/
usefulusability.com
is another good site, they regularly have good articles up there.
Oh, and another article we had published recently:
www.1stwebdesigner.com/development/usability-ux-pitfalls-howto-avoid/
I think this one provides some pretty good examples of issues that frequently pop up, and how to avoid them.
And if you are looking to run a simple usability test, what not check us out at IntuitionHQ.com
Good luck!
What reading would you recommend on general debugging techniques? I am more interested in principles and best practices than in specific platform solutions. For the record I mainly work with .NET (F#, C#), and dabble in Haskell and Ocaml.
One of these Friday evenings we talked about debugging with my colleague on our walk home. I was surprised to learn that one can view and modify the state of live objects from the VisualStudio debugger. He also mentioned that another developer he knew, a "Java guru," had once shown him some debugging magic and given an article or booklet on debugging, which challenged my colleague's initial "there's nothing to it" attitude. Having spent more time than I wished hunting bugs, I am ready to be challenged as well. Are there any links you would recommend?
I'd recommend reading everything you can find on Test-driven development (TDD). From the Wikipedia article:
Programmers using pure TDD on new
("greenfield") projects report they
only rarely feel the need to invoke a
debugger.
From a personal standpoint, it's been my experience that the more unit tests I write, the less time I spend in the debugger.
Specifically for .NET, here's a nice article on Easier Debugging with Attributes.
I highly recommend the excellent book Debugging by David Agans.
While not specifically about programming, the principles are universal. One of the techniques in here provided the biggest quantum leap in my diagnostic capabilities, namely, backing out your fix to prove that just your fix has corrected the problem.
I've studied a lot of debugging books and thoughts. Probably the best one is Debugging By Thinking. I think it covers everything that needs to be said, in a logical fashion, in an easy-to-read package.
It takes a native approach (win32) but Advanced Windows Debugging is a great book.
I like Ian Taylor's.
Tess Ferrandez's blog If broken it is, fix it you should is both directly relevant to specific real-life scenarios you're likely to encounter in .Net debugging, (typically involving ASP.Net), and more generally thought provoking.
John Robbins' debugging books and blog are similarly worth reading.
Mike Stall's .Net Debugging Blog likewise.
Mark Russinovich's blog is remarkable - his knowledge of Windows internals combined with great forensic skill is impressive.
My first introduction to debugging was this tutorial. It uses GDB to debug a sample C++ code, but the principles are generally applicable. The thing I really like is the way the author explains his train of thought about what might be wrong, and then the specific commands needed to test the possibilities. It's pretty fun! If you're new to debugging, it's a great insight into the process.
I'm looking for a site or book or any other source of tiny programming tasks one can implement in preferred language. Would be great if examples are present too. And would be superb if there're people who may review my code. May be there's a wiki of such tasks. I've tried to google, but found nothing that suits my needs.
I want to improve my skills in programming using certain language but don't have specific task at hand. Any advice would be greatly appreciated.
Project Euler and the Facebook Puzzles are oft-touted examples.
There's a book called "Programming Pearls" by Jon Bentley which is definitely worth reading and trying out...
Chris Rathman is one of at least a few people I've seen who are working the exercises in Structure and Interpretation of Computer Programs in multiple languages. I'm currently still in the Scheme phase, but it seems like a neat exercise to me!
Try sourceforge, there are many interesting projects and many of them are looking for volunteers.