How to add a new feature to an existing component? [closed] - legacy-code

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.
We have this legacy image viewer component in our project that's working fine but it's source is a real mess. I have to add a new feature to this component so that people can add annotation to images using a light pen which is not a complicated task per se but could be a nightmare dealing with our existing code.
I'm really confused right now I don't know where should I start . do I have to refactor the existing code?if not what else can I do?
So here's my question: What could be the best (less painful) approach dealing with such situations?

The question is not an exact duplicate, but this exact same answer applies (you just have a list of one change)
https://stackoverflow.com/questions/1386824/hired-as-a-developer-to-maintain-and-update-current-code-base-no-docs/1386844#1386844

Write lots and lots of tests that will allow you to verify that changes you make to the system do not change or break existing functionality.
These tests are like the brace-work that is used to support a physical building when a construction crew is doing reconstruction. That brace-work is used to keep the existing infrastructure intact. You need to preserve the infrastructure of your system with as many unit and integration tests as you have time to write.
These tests will allow you to make small, iterative changes to the system and easily verify that those changes still maintain the expected behavior.

You should read this very good article Big Ball of Mud. And for your answer we all get a big ball of mud at some point and we need to add new functionality to it. Re-factoring such a code is not a good idea since it require alot of testing. But adding few new lines will not harm it. So unless you have alot of time and so does the tester just add the new functionality to your existing code. Although the current code look messed up but remember it works and tested. Read the article and makeup your mind as to which approach is good.

Related

Does it make sense to write a forum in Scala? [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'm looking for a meaningful task to learn Scala (something which is usable at the end and not only programming exercise), and I also have to make a forum, and I don't want to learn PHP... so I'm thinking about implementing an open source forum in Scala.
But does this make sense? Forums don't have high performance or scalability requirements... and also Java Hosting is more expensive, so even if my forum software is free, most people will not use it.
Am I missing use cases where forum written in Scala/Java makes sense, and is preferable over a PHP (or similar) forum?
I found for example this:
http://java-source.net/open-source/forum-software
But it seems to be abandoned, like stated here:
http://www.coderanch.com/t/497053/Ranch-Office/forum-has-been-built-JForum
So probably I'm correct that easy & cheap & slow is far more suitable for a forum = PHP?
I think an open source forum written in Scala would be useful if you can structure it in a way that makes it easy to integrate with existing web apps using the Lift and Play frameworks.
Your target audience should be anyone writing a web app in Scala who wants to tack on a forum. The prospect of using a php based solution won't be enticing to these developers, but neither will be reimplementing the wheel. You have a pretty compelling value proposition if you create a well written, easy to implement solution using the same stack that they are already leveraging.
It depends on the purpose of the exercise.
You want to learn Scala and need a project for exercise:
Anything goes, so does a forum. But it would probably be more interesting to get involved in some existing open source project. Think about the 5 first libraries you would probably consider for a project (logging, testing, web framework) check them out, find one that is open for contribution. Grab a bug or feature request and try to implement it.
You want some forum
Forget it. Use some existing solution.
Somebody forces you to write a forum
If things like being hostable on almost arbitrary webspace isn't a requirement, go ahead use Scala.
You want to prove the power of Scala to yourself or somebody else
Go for something more challenging (Big Data, Akka ...)

why doesnt everyone use frameworks [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.
well lot of forums and even this site is full of questions where people don't use any framework(whetever language they use) and they are stuck on code for common tasks like logins,database accesses,etc while frameworks provide code that works correctly for these routine tasks. Then why do people still go without frameworks? i want to know this because i am trying to build something of substantial scale so i was deciding if i really need a framework or a homegrown solution would be better? a homegrown solution can be a great learning experience but is there something more to it?
Some reasons:
Some tasks are so small that it's easier to do them without a framework, which:
would have to be bundled;
would take up an order of magnitude more space than the app itself;
would impose a lot of requirements both for the app and the hosting platform;
would provide unnecessary overhead because of a lot of features which are unused in the particular app;
Wanting to find out about how things work;
Homework assignments;
Not being able to use the framework for some reason (constrained space, not enough permissions, etc.)
Not knowing about these frameworks;
Reducing dependencies on external libraries;
Legacy reasons (the app is old, it was started before any serious frameworks were out);
People go without framework for several different reasons, in my opinion the choice of developing in-house functionality is not always a bad choice.
Frameworks often don't implement all functionalities required but often add extra functionalities that will never be used making the code base unecessary "bloated".
Implementing a framework often requires a steep learning curve and often it is easier to implement certain functionality in house.
However often a framework can be the best choice but developers jump into coding without doing enough research beforehand.

Flexibility of Yii [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 have come across a fair bit of information on CI being a really flexible framework. Does Yii also allow great flexibility? And the ability to pick and choose when to use it or your own php?
Flexibility is very subjective, so this question is a bit vague.
From my experience I can tell you that Yii is very very powerful, but in most cases when you want to go into really advanced territory you have to do things "Yii's way". If you do, you will find that the pieces of the puzzle click together really well and things go smoothly. If you don't (because presumably you haven't realized yet what "Yii's way" is), it's going to give you a hard time.
I am using YII since 2 years. I use it with combination with Zend AMF and create backend systems for Flash campaigns, create HTML5 webpages, simple pages, different competition pages and and find it usable for every case you need. The main advantage that it is really structured, logical and fast. So because of that I am spending my time on creating application logic, not on setting up environment, setting up all requests, pages, subpages etc., MVC model + ActiveRecord saves my time here.
I have been using Yii for a year now and find it very flexible. You can add your own methods to any model or write components outside models. You need to be familiar with the MVC structure, Object-oriented programming and for writing components, you need to know how to register the component in the config file and how to call it the Yii way.

What are good criteria for grading programming assignments? [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'm going to be teaching a scripting and tool development class to a group of 3D animators. In amongst teaching them coding fundamentals, I plan to have them pick a repetitive task they must perform frequently and have them iteratively develop a tool to automate or simplify this task as an assignment.
What I'd like to know are some criteria that can be used for grading programming assignments such as these? Some of the criteria I came up with were:
Does It Work - Does the tool perform it's task, does it break on certain cases, etc.
Code Cleanliness - Has the code been properly indented, is their coding style consistent, etc.
Documentation - Are functions well documented, are any "clever" bits of code commented, is it under-commented or over-commented, etc.
Efficiency - Has the script been optimized to run quickly, has a lot of unnecessary optimization been done on a task that isn't run very often, etc. (This one I'm not going to put to much emphasis on since these aren't professionally developed tools usually the tool working is more important than speed)
Are there any others?
Clarity. It's important that their code be comprehensible to anyone competent who should chance to open the file.
Does the way the student went about the exercise indicate that they have paid attention to what was taught in class?
You are right to look beyond "does it work"; look for general approach and "craftsmanship".
Do you teach the importance of testing? Look for test cases.
If they had freedom to choose their tools, did they choose wisely?
(no plagarism, obviously)
Are the invariants documented? Are there any unit tests?
Is the entire script broken up into modules or other units of about the right size?
(The inability to break up codes of over 100 lines is a bugbear of beginning programmers.)
Tell Them how it is going to work in terms of file locations etc. Provide one set of data for Them to test ón and another for testing their solutions.

Difference between a custom build CMS and an open source CMS [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.
What is the difference between custom building a CMS website and an open source CMS?
If you build the CMS yourself you have the great opportunity of going through all the problems and bugs that have already been encountered and fixed by the people the build open source CMS before. ;-)
Seriously, in my opinion, building your own CMS only makes sense if there is no open source CMS that you can customize to fit your needs. I think that you will have less trouble (and it will take less time) customizing some existing CMS.
Depends on what you need, how much time you have and how much coding experience you have. For example you could go and write your CMS, add only the functionality you need and keep it rather simple. But you'll have to debug it, take care of many issues like character encoding, security and you'll have to write even simple functionalities like an internal search engine. If you use something like Joomla, Wordpress or Drupal (just to mention the most popular ones), you'll have very well tested environments that have been patched for many security issues. You'll find hundreds of extensions like photo galleries, search engines, multiple language support. The drawback is that if you want to add something particular you have to spend time learning their API... but probably that would require less that coding something on your own... or may not. It's all about the complexity of what you need. You should try taking a look at one CMS API, I suggest a popular one so that you'll find plenty of examples on Google, then try to figure out how difficult it can be to learn and finally make your decision.