|
-
Mar 16th, 2011, 11:47 PM
#1
Thread Starter
Fanatic Member
Good Design Parameter
Locality
Not repeating code
Modifying program means modifying one aspects
What else?
-
Mar 17th, 2011, 01:47 AM
#2
Re: Good Design Parameter
-
Mar 17th, 2011, 02:33 AM
#3
Thread Starter
Fanatic Member
Re: Good Design Parameter
-
Mar 17th, 2011, 02:50 AM
#4
Re: Good Design Parameter
 Originally Posted by teguh123
I need more detail.
Did you follow the link?
-
Mar 17th, 2011, 03:52 AM
#5
Re: Good Design Parameter
-
Mar 17th, 2011, 05:00 AM
#6
Re: Good Design Parameter
I guess you have to start first with a certain design patern and build up from there:
http://en.wikipedia.org/wiki/Design_...puter_science)
-
Mar 17th, 2011, 07:19 AM
#7
Re: Good Design Parameter
I prefer to keep my SQL in one module (shared class), use the UI to do simple validation and just copy to and from classes which contain the bulk of validation (business rules). This is called the N-tier model. Any functions used by more than one object I either put in their own module, or in a base class. For the classes that represent business objects I implement a common interface.
As far as good design, you can create arguments on what is good because some aspects are only good depending on the project. And programming is 50% art and 50% science. The main thing is to be consistent, don't be afraid to evolve to remain consistent (don't fail to improve your app or coding style to stay consistent if their are clear benefits), and ensure it is clear as to what you are doing not only for the person who follows you but also for yourself.
VB6 Library
If I helped you then please help me and rate my post!
If you solved your problem, then please mark the post resolved
-
Mar 19th, 2011, 07:57 AM
#8
Thread Starter
Fanatic Member
Re: Good Design Parameter
-
Mar 19th, 2011, 08:10 AM
#9
Re: Good Design Parameter
-
Mar 19th, 2011, 08:59 AM
#10
Thread Starter
Fanatic Member
Re: Good Design Parameter
Another great answer. But that single responsibility principle. Does that work for vb.net given that vb.net don't support multiple inheritance?
Also about code refactoring.
Often I see that my project need a file. I add that file and found out that the file need another file. Finally my project are often filled with files and function that it never uses.
Is there something like refactoring rules I can learn?
-
Mar 19th, 2011, 09:16 AM
#11
Re: Good Design Parameter
 Originally Posted by teguh123
Another great answer. But that single responsibility principle. Does that work for vb.net given that vb.net don't support multiple inheritance?
SRP and single/multiple inheritance have nothing to do with each other. SRP says that each class or method should have a single responsibility. For instance, you don't create a class that downloads files from the internet and retrieves data from a database. If you are in a situation where you need both those things, then you create one class whose single responsibility it is to do one of them, another class it is to do the other and then a third class whose single responsibility it is to host the other two.
 Originally Posted by teguh123
Also about code refactoring.
Often I see that my project need a file. I add that file and found out that the file need another file. Finally my project are often filled with files and function that it never uses.
Is there something like refactoring rules I can learn?
Again, those are two concepts that are unrelated. Refactoring means changing the implementation without changing the interface. Often times you will write code just to get a job done, without caring exactly how. Once you get it to work, then you refactor the code to make the implementation cleaner. In fact, refactoring is a practise that you can use to ensure that you are using the SRP. You might write a method to get a job done and later refactor that single method into multiple methods that each have a single responsibility.
What you're talking about is just something that you have to live with at times. I think you're over-dramatising it a bit though. There are times where referencing one library will require that you reference another too, but such occasions are not common. The only one I can actually think of in my 8 year .NET development career is when using the Entity Framework. There may have been others but they are obviously few and far between if they're so hard to recall.
-
Mar 19th, 2011, 09:21 AM
#12
Thread Starter
Fanatic Member
Re: Good Design Parameter
 Originally Posted by jmcilhinney
SRP and single/multiple inheritance have nothing to do with each other. SRP says that each class or method should have a single responsibility. For instance, you don't create a class that downloads files from the internet and retrieves data from a database. If you are in a situation where you need both those things, then you create one class whose single responsibility it is to do one of them, another class it is to do the other and then a third class whose single responsibility it is to host the other two.Again, those are two concepts that are unrelated. Refactoring means changing the implementation without changing the interface. Often times you will write code just to get a job done, without caring exactly how. Once you get it to work, then you refactor the code to make the implementation cleaner. In fact, refactoring is a practise that you can use to ensure that you are using the SRP. You might write a method to get a job done and later refactor that single method into multiple methods that each have a single responsibility.
What you're talking about is just something that you have to live with at times. I think you're over-dramatising it a bit though. There are times where referencing one library will require that you reference another too, but such occasions are not common. The only one I can actually think of in my 8 year .NET development career is when using the Entity Framework. There may have been others but they are obviously few and far between if they're so hard to recall.
And finally my list manipulator program have codes that encode automatic posting to wordpress. Something is just wrong.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|