is there a book overviewing different types of source code metrics? [closed] - code-metrics

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 have to submit a paper about the usage of source code metrics in software engineering processes. I thought it would be nice to start by introducing some categorization of source code metrics (for example using plane LOC count Vs doing some static analysis of the code) , but I can't find a book or article that will present the different types of metrics and possibly some historical background information (books and article are favored by my instructor over web sites).
any one knows of such a source ?

Patrick Smacchia's NDepend site has a good set of definitions: Metrics Definitions. His NDepend tool (for .NET) provides many different ways of quantifying a codebase.
How useful metrics are, well that is a bit more contentious. They are good for getting a sky level view of a codebase, but are they useful day-to-day? How many shops out there use (or care about) metrics on a weekly basis? I suspect most are more concerned with the bug count: number of bugs fixed and number of bugs reported.
Certainly measures like cohesion and coupling give indicators of possible refactoring points.
Another important metric: How many tests are there, and roughly how much code coverage do those tests represent. Refactoring without tests and good test coverage is a risky business.
Software metric
Code Metrics Overview

Pressman's Software Engineering: A Practitioner's Approach has a lot of good information on software metrics (among other things).
Probably the key piece of advice on metrics is to be careful what you measure. If you measure LOC, that's what people will concentrate on.
"Not everything that can be counted counts, and not everything that counts can be counted."
--Albert Einstein
"Measuring software productivity by lines of code is like measuring progress on an airplane by how much it weighs."
--Bill Gates

Metrics and Models in Software Quality Engineering
Stephen H. Kan
Not always very fun to read, but it's an excellent book that covers software quality and metrics in depth.

Halstead's "Elements of Software Science" was the seminal work in this area. As I recall the tale, he defined some 15 different metrics, all purporting to measure different qualities of a piece of code.
Unfortunately, van der Meulen & Revilla showed that a couple of key metrics are very strongly correlated with SLOC (source lines of code). (This was not the first time this had been demonstrated, but it was the first paper I could find quickly.) Since SLOC is far easier to measure than the other things, SLOC is what should be measured - and managed.

PSP: A Self-Improvement Process For Software Engineers by Watts S. Humphrey

Also check SLOCCount. This is not a book but a set of tools for counting physical Source Lines of Code. Going through its user manual and the papers in the site about the usage of SLOCCount for estimating Linux kernel size will give you insight about effectiveness of SLOC metrics,issues in using it as metric, usage of SLOC metric in the COCOMO model for effort estimate.

It's not a book, but the metrics used by Sonar offer a good list of practically useful code metrics. Here's the metric definitions page.

As I just mentioned in my question on visualizing changes in metrics, there are the books Object-Oriented Metrics:Measures of Complexity by Henderson-Sellers and the earlier Object-Oriented Software Metrics which I've owned for years.
There's Metrics and Models in Software Quality Engineering, Second Edition, the only one of the books available on Safari which has a chapter discussing the above metrics and some industry results.
I also just found a 2006 book Object-Oriented Metrics in Practice: Using Software Metrics to Characterize, Evaluate, and Improve the Design of Object-Oriented Systems which has no reviews there (not a good sign) but sounds interesting.

Related

Neural Networks [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 want to learn more about AI and neural networks. I have some basic idea what it is and how it works, but I want to find a good book or tutorial with good explanations.
Anyone know of some good material ( that is not too technically written ) to read on the subject?
C# implementations are also helpful.
Good question... There is a impressive collection of books and online texts on the subject of neural networks (NN), but many of them are either very technical or focus on somewhat specific domains of application of the NN, artificial vision, pattern recognition and signal processing being the "natural" leaders in this genre.
I'd like to second Chaos' recommendation of
Fundamentals Of Neural Networks
Architectures, Algorithms And Applications
by Laurene Fausett
For an introduction to the field, this book strikes a good balance in terms of accessibility, detail and coverage. The alternative are older books circa 1995-2000 which tend to be a be more of the vulgarization type.
You can also wet your appetite with online resources such as:
A tutorial from learnartificialneuralnetworks.com (the site itself also has several good references)
A class at Williamette University
When all fails, a quick scan of NN FAQs
Finally, at the risk of confusing you, at a time when you need a broad view on the subject, I'd like to plug a specific type of neural network: Numenta's Hierarchical Temporal Memory concept.
Checkout http://ml-class.org an online distant education by Stanford, Prof. Andrew Ng is taking the classes, i think it is the best way to get into Neural Networks and machine learning. Also a similar class on Artificial Intelligence: http://ai-class.com taken by Prof. Peter Norvig, Sebastian Thrun. I cannot say if the videos and course materials will be online even when the course ends, but if it stays then it would be a very good resource.
Also have a look at this book: Neural Networks - A Systematic Introduction by Raul Rojas. This will give details about ANN.
EDIT
Also checkout the upcoming Coursera Neural Network class: https://www.coursera.org/course/neuralnets
I found Fausett's Fundamentals of Neural Networks very accessible.
I have been working with Neural Networks for about 10 years, and still have Neural Networks: A Comprehensive Foundation on my desk.
There are some good articles on code project, here is just a few:
http://www.codeproject.com/KB/recipes/NeuralNetwork_1.aspx
http://www.codeproject.com/KB/recipes/Backprop_ANN.aspx
http://www.codeproject.com/KB/recipes/GA_ANN_XOR.aspx
http://www.codeproject.com/KB/recipes/encogintroxorcs.aspx
You may like to try using FANN, it has bindings for C# (I use the C library) and comes with examples to help get you started.
Try Simon Haykin's book at:
http://www.amazon.com/Neural-Networks-Learning-Machines-Edition/dp/0131471392/ref=sr_1_1?ie=UTF8&qid=1331331157&sr=8-1
However, the best way do it the http://ml-class.org. It is a step-by-step tutorial on solving a few interesting ML problems.

Modeling and Simulation Programming Language [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 work with many different models and simulations. Some of the older models and simulations are written in FORTRAN. Some of those models have been converted to C++, but the current trend is to create these models using MATLAB/SIMULINK. From a computer science perspective I have always felt MATLAB/SIMULINK was not a good solution. What language do you use to create models and simulations and why?
I would always try to use the language that is provided by the best modeling and simulation tool (or library, if you like) to do the job for me.
And this question can really only be answered by taking into account what kinds of models you want to implement. Continuous (e.g. ODEs), discrete (e.g. StateCharts, Petri Nets), or a combination (i.e. a hybrid model, as can be implemented with Simulink+StateFlow)? There are various tools for each kind of model.
Another important aspect would be the domain in which you are working. Simulink has pretty extensive libraries for electrical engineering, finance, or computational biology (most of them are included in additional packages, though) - if you work in one of those fields, there might simply be no better (i.e. complete, valid) component library. The same goes for other commercial simulation packages, such as AnyLogic, Arena, etc. There might also be some open-source simulation tools, depending on your modeling problem.
Finally, you might prefer a specific programming language over another, and you might have additional requirements, e.g. support for
Optimization (of model parameters)
Validation
Output analysis (statistics, plots, statistical tests)
Support for parallel and distributed simulation
Model checking
...
So I'm currently working with Java with the well-known advantages - reasonably fast, good support for multi-threading, relatively simple to use etc. But if 'reasonably fast' is not fast enough, there might be no option but going down one level of abstraction :-)
I also work with a lot of legacy code, most of it in Fortran. I really don't mind using Fortran - all the modern compilers allow variable names greater than the old and silly 6 character limit. Also, with Fortran 95, you can even do OOP if you feel that your modifications to the existing codebase would benefit.
Also, there are very good code editors for Fortran, which isn't always the case for more specialized script languages.
C++ has the great disadvantage of memory considerations. I have been programming C/C++ for 20+ years now, and I still forget to delete objects and properly fill in destructors.
On a final note, if you're using Windows, there is a Fortran.NET compiler (I think from Lahey-Fujitsu?) if you want to move your Fortran to a managed environment.
Good luck!
SIMULA of course !! :-)
What I've gotten out of MATLAB is it's ability to let me quickly prototype an algorithm. I can really get a good feel for the data by plotting it and using the built in statistics functions. When trying something new out, I can do something quick and dirty to get some initial results, then go back and clean things up to refine my results. With compiled languages, there's a lot more I have to do just to get the simulation to run. With MATLAB, I spend more time thinking about the real problem, and less about compiling, linking, memory management, etc.
However, there are many problems that MATLAB is just ill-equipped to solve. For large data sets, a compiled language with user defined data structures is almost certainly necessary.
Particle physics has been moving to C++ and python. This is not universal, and probably wouldn't even be close were it not for the ubiquity of ROOT.
Root's use of cint means you needed bother with memory management when you're dinking around with a new idea, it's capacity to run compiled allows you to have speed, the ability to mix the modes is very helpful, and the bindings for python and other RAD languages allow for great flexibility.
In a very real sense, this comes down to an endorsement of roland's point.
you can use s-funcuin block for linking fortran(c,c++) with matlab.

How to keep code and specs in sync? - are there good tools [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
In my team we've got a great source control system and we have great specs. The problem I'd like to solve is how to keep the specs up-to-date with the code. Over time the specs tend to age and become out of date
The folks making the specs tend to dislike source control and the programmers tend to dislike sharepoint.
I'd love to hear what solutions others use? is there a happy middle somewhere?
Nope. There's no happy middle. They have different audiences and different purposes.
Here's what I've learned as an architect and spec writer: Specifications have little long-term value. Get over it.
The specs, while nice to get programming started, lose their value over time no matter what you do. The audience for the specification is a programmer who doesn't have much insight. Those programmers morph into deeply knowledgeable programmers who no longer need the specs.
Parts of the specification -- overviews in particular -- may have some long-term value.
If the rest of the spec had value, the programmers would keep them up to date.
What works well is to use comments embedded in the code and a tool to extract those comments and produce the current live documentation. Java does this with javadoc. Python does this with epydoc or Sphinx. C (and C++) use Doxygen. There are a lot of choices: http://en.wikipedia.org/wiki/Comparison_of_documentation_generators
The overviews should be taken out of the original specs and placed into the code.
A final document should be extracted. This document can replace the specifications by using the spec overviews and the code details.
When major overhauls are required, there will be new specifications. There may be a need to revisions to existing specifications. The jumping-off point is the auto-generated specification documents. The spec. authors can start with those and add/change/delete to their heart's content.
I think a non-Sharepoint wiki is good for keeping documentation up to date. Most non-technical people can understand how to use a wiki, and most programmers will be more than happy to use a good wiki. The wiki and documentation control systems in Sharepoint are clunky and frustrating to use, in my opinion.
Mediawiki is a good choice.
I really like wikis because they are by far the lowest pain to adopt and keep up. They give you automatic version control, and are usually very intuitive for everyone to use. A lot of companies will want to use Word, Excel, or other types of docs for this, but getting everything online and accessible from a common interface is key.
As much as possible the spec should be executable, via rspec, or doctest and similar frameworks. The spec of the code should be documented with unit tests and code that has well named methods and variables.
Then the spec documentation (preferably in a wiki) should give you the higher level overview of things - and that won't change much or get out of sync quickly.
Such an approach will certainly keep the spec and the code in sync and the tests will fail when they get out of sync.
That being said, on many projects the above is kind of pie-in-the-sky. In that case, S. Lott is right, get over it. They don't stay in sync. Look to the spec as the roadmap the developers were given, not a document of what they did.
If having a current spec is very important, then there should be specific time on the project allocated to write (or re-write) the spec after the code is written. Then it will be accurate (Until the code changes).
An alternative to all of this is to keep the spec and the code under source control and have check-ins reviewed to ensure that the spec changed along with the code. It will slow down the development process, but if it is really that important ...
One technique used to keep the documentation in sync with the code is literate programming. This keeps the code and the documentation in the same file and uses a preprocessor to generate the compilable code from the documentation. As far as I know this is one of the techniques Donald Knuth uses - and he's happy to pay people money if they find bugs in his code.
I don't know of any particularly good solution for precisely what you're describing; generally, the only solutions that I've seen that really keep this sort of stuff in sync are tools that generate documentation from the source code (doxygen, Javadoc).

What is the most impressive Lisp application? [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 know that this is subjective and all, but still, can you provide some list of serious applications that were written in Lisp (perhaps along with what Lisp it is)?
Emacs.
At least parts of it are written in Emacs Lisp.
ITA Software's airline-fare search service. See here to understand why this is impressive.
LISP itself! :)
DART. A logistics app written in Common Lisp for the first gulf war, to free Kuwait from Saddam Hussein. One could say that the war started when this app was ready. The developers worked under intense time pressure to make it possible.
This single application is said to have paid back for all (!) US government investment in AI research.
I'm particularly fond of Maxima. Another nice project I've discovered relatively recently is Nyquist.
One of the most impressive Lisp applications is surely Cyc. Cyc is a project started by Doug Lenat that tries to put common-sense knowledge into a knowledge-based system. Not just a bit, but really really lots of knowledge. Humans have learned a lot of widely different things and it was seen a limitation to artificial intelligence software to not know anything of that. What is the typical color of honey? Do we sit on a chair or under a chair? A cup of fresh coffee is hot. When it rains outside, it does not rain inside. Sea water contains salt, but water in a pond does not. Most birds can fly. Some birds can't fly. It is surprising how many of these facts, rules and concepts people know.
Cyc is under continuous development since 1984 and the knowledge base contains (numbers are from 2004) more than 2.5 million facts and rules. It also contains more than 150 thousand concepts (similar to classes in OOP). Cyc is developed in SubL (a dialect of Common Lisp).
Knowledge is entered in CycL (a declarative logic based language). Specially trained people are entering knowledge. Cyc checks that this new knowledge is not in conflict with existing knowledge. It can also derive new conclusions and one can query it. For its answers it can also generate explanations. Cyc has also many domain-specific heuristics implemented.
In the early days the project started developing on Lisp Machines, but today the software is portable and is also available to interested students and researches (OpenCyc and ResearchCyc).
Lisp Machines were used by NASA to check Space Shuttle starts. From a Symbolics press release from 1990:
"Recently the National Aeronautical and Space Administration (NASA) used Symbolics'
high-definition technology to analyze HDTV video images of the
Discovery launch in real-time. This high-definition system enabled
NASA engineers to get an instant replay of critical launch systems.
The engineers were able to enhance and enlarge high-resolution images
of the lift-off in order to analyze the condition of and spot
potential problems with space shuttle tiles."
They used a bunch of Lisp Machines with special image processing boards.
Sawfish was GNOME's default window manager long time ago. Now they default to Metacity, but you may still use Sawfish (also standalone) and it is still actively developed.
Sawfish is very feature-rich and customizable. Just what you would expect from a LISP window manager.
What eventually became Yahoo! shopping was done with Lisp. See the original author's description
AutoCAD
G2
Yahoo Store
Obidos, The Original Amazon Web Server
This according to Steve Yegge.
http://steve.yegge.googlepages.com/tour-de-babel
Whitehouse Publication Server
During the Clinton administration a Lisp application was used to inform the US citizens about government news. The application was written in Common Lisp and ran on top of the CL-HTTP web server on two Symbolics Lisp Machines (later on the Open Genera virtual Lisp Machine). It also used the Statice object-oriented database. The application provided a taxonomy of government areas which could be queried with a web or an email interface for publications. For example citizens could find out what the vice president Al Gore said about environmental issues in a certain week. This was application was shut down by George W. Bush when he came into office.
Orbitz.com?
Another application I really like is PWGL.
PWGL is a visual programming language for computer aided composition and sound synthesis. It is a LispWorks application, which is available for Windows and Mac OS X (free download). It uses a lot of sophisticated graphics (done in OpenGL) for example in its advanced note editor. It can process and create sounds. It also can use Midi input and output. It comes with a really large amount of examples in its tutorial. If you have LispWorks, you can also load the binaries and write your own code using it.
The capabilities of the application are really amazing and if you are willing to learn its usage, it is hours of fun for the hobby composer and hobby sound designer.
Probably, not the most impressive, but really worth mentioning, considering, that it's mostly a one-man effort: http://piano.aero/
It's hard to say which Lisp software is exactly most impressive, but I would add Symbolics Genera and related software to the list of achievements worth mentioning. Also don't forget SLIME.
See this question for a list of many commercial uses of Lisp.
IRCAM's OpenMusic (computer-aided composition environment).
The matchmaking server for Zone: The Battleground is written in Common Lisp. Their website.
http://www.thanandar.de/
LISP, or at least the LISP evaluator.

Design patterns for Agent / Actor based concurrent design [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
Recently i have been getting into alternative languages that support an actor/agent/shared nothing architecture - ie. scala, clojure etc (clojure also supports shared state).
So far most of the documentation that I have read focus around the intro level. What I am looking for is more advanced documentation along the gang of four but instead shared nothing based.
Why ? It helps to grok the change in design thinking. Simple examples are easy, but in a real world java application (single threaded) you can have object graphs with 1000's of members with complex relationships. But with agent based concurrency development it introduces a whole new set of ideas to comprehend when designing large systems. ie. Agent granularity - how much state should one agent manage - implications on performance etc or are their good patterns for mapping shared state object graphs to agent based system. tips on mapping domain models to design. Discussions not on the technology but more on how to BEST use the technology in design (real world "complex" examples would be great).
Even if I cannot come up with any good real world examples that provide you with design
patterns straight up, there are a few places to start.
The first is getting your head wrapped properly round the concepts. One book helping
you do this is Making reliable distributed systems in the presence of software errors
written by an Erlang Guru Joe Armstrong where explains Concurrency Oriented Programming
in a very accessible way. It is in fact a Ph.D. thesis, but do not let that scare you.
It is by far easier to read, and pleasant into the bargain, than most common text books.
Looking at actual systems normally means that you have to learn too much about the actual
language for it too make sense just to evaluate things. For Erlang the documentation
provides design methodology and behaviours(Erlang speek for design pattern libraries).
This will illustrate the design patterns most commonly used in this setting. And these
have proved to be effective in building large scale systems, i.e. millions of lines of code (comparable to a factor 4 to 10 of other languages such as Java) and milloins of concurrent processes running on one machine in distributed clusters of machines.
A recent example of a real live system is Facebook Chat.
For the other frameworks I cannot really help you I am afraid.
An "actor" is itself the unifying pattern for concurrent programming (an asynchronous message queue plus an execution context for processing it), but there are many design patterns which assist in specifying aspects or elements of agent-based systems. Many of the most common can be found in Wikipedia's article on Concurrency Patterns. Some highlights:
Reactor Pattern
Mediator Pattern
Scheduler Pattern
Observer Pattern
If you haven't come across it already, Akka may be of interest to you -- it is a "purely" event-driven actor framework running on the JVM.
I asked a similar question here which had some reasonable answers that may help. I'm watching yours carefully. I haven't yet found something which has really helped me, but I am very actively looking.
I think the mind-shift is the single largest barrier to stepping to concurrent architectures and languages and until that is cracked developers are going to stick with easy to learn MS style paradigms. For it to really become mainstream it needs to find its way into schools and be taught alongside C# and VB.
My answer to the 2080 programmers question is "concurrently".