×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

Some thoughts....

本文发表在 rolia.net 枫下论坛1). If we assume that the clients are the same, the increase of client numbers cannot be the reason to modify the code. If the clients can be classified into come classes,
one may need to modify the code or configure the whole system. This is why I stress one must distinguish one client from one class of clients. Without business context, it is pointless to talk about patterns.

2)If the clients are almost the same and they enjoy the service provided by the server, one can use connection pooling, which is already a pattern. In JDBC and EJB, connection pooling technology provides some scalability. However, any server (DB, EJB...) has an upper limit in serving the clients.

3) If the clients can be classified, I still suggest using Adapter and Facade patterns.
Whenever a new class of clients come about,
one can add a new Adapter for them WITHOUT modifying the original code. With the help of Facade pattern, one can output service by adding one or two static methods.
It sounds trivial, but it may solve the problem to some extent. Adding some code is better than modifying the original code.

4) As we talk about the pattern, we should ask: Does the same thing occur REPEATEDLY in the life? One cannot claim a pattern simply because he/she meets a new issue. In addition, the life (or the project) is complicated, behind some seemingly simple fact are a bunch of patterns co-operating with each other.

5) Some time earlier, Marco posted his experiences in a VC++ project. In that project, the system did not work well as the client population reaches 800. Obviously, such system limitation cannot be cured by using some patterns.

6) Indeed, patterns are an advanced topic for programmers. If one does know patterns, or has not yet read the book by Gang of Four(GOF), he/she does not need to be discouraged. (Honestly speaking, I have not yet got the chance to lokk into the Gang Of Four book. Probably, I won't read it in the future.) If one is a pattern guru like Mark Grand, he/she does not show off before the peer. My client has a system architect who cannot code in C++, but nobody can deny his string perspective in the system architecture.

7) If something is pushed to extremities, things may not go on as expected. For instance, we know that methodology is very important for OOP. If one sticks to the philosophy of three Amigos, the project may fall into the analysis paralysis. Likely, if one insists fitting into some patterns in each aspect of a project, things can become fanny.

8)Having reading some famous books does not mean being a guru. Aconcoction of pattern cannot yield a robust project. If one cannot make himsel/herself understood, he cannot undertake the task of being an architect.
This is why I have ever said that few Chinese guys can play a role of architect. Being an archiect, one should be able to communicate with novices, laymen using everyday English. If the partner does not understand, one should try to get him/her accrossed using examples.

9) Just like Marco, I have nothing more to say.
Marco told me that many developers in Canada have read the GOF book. What I realize is that some developers I know are abusing patterns, or using patterns for pattern's sake.更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / I have several clients, there is a little bit difference among them, maybe I'll have more clients in future, how to design the architecture?
    • Man, your question is too big to answer
      One of my chief architects taught me: " Each project is unique." Your experience in the present project will be helpful for your future projects. However, please don't think you can work out an architecture that can be applicable to several projects. I don't hope your clients trust you with any architecture assignments. -): -):
      • in details.
        I'm a server, serveral clients (not customer) connect with me, ...
        • Man, what server are you? -): -): ? what clients does your server have? what is your business rule? Without these pre-conditions, no one can talk about the architecture.
          • It doesn't matter, don't care about the details of server and clients, the most important is, 1, several clients which are a little bit difference 2. the number of clients will be increased sometime I need a pattern only.
            • Did you mean scalability?
              本文发表在 rolia.net 枫下论坛There is no absolute scalability. You should know how many clients you server will serve potentially. If it just serves 10-300 clients, you may use any server you like. If you will build a huge site, you should take into account load balancing and fault tolerance. Then, you you need build a distributed system. In the enterprise Java, one usually build distributed system using Enterprise Javabeans and scalability is realized by server clustering technology.

              The first step in a regular project is to know what your business is about. If one is unclear about the scale of his/her project, it is
              pointless to consider its architecture, Even one creates an architure, it is usually pathological.

              By the way, I have a suggestion for you. Don't assume the people you are communicating is an expert, even she/he is your chief architect. Frankly speaking, I did not understand your postings well because your writing was so casual. I understand it is partially because your langauge skill is not so good. But more likely, it is because you thought that people should be able to understand your question.

              Please take my criticisms as a friendly piece of advice. I intend to help you, not to hurt you.
              Your writing is too simple, too brief. You did not set up the context for your question. IF you cope with Non-Chinese speakers this way, they will think you have communication problems and you may lose your job. I am not scaring you. I have witnessed such stories several times since I began my programmer carrer. I encourage you to learn from fly_eagle. Two weeks ago, he met a problem. His English is not so good. However, he did his best to describe his problem in his posting so he succeeded in getting help here.

              My words may hurt your feelings. If so, I apologize in advance. I am a volunteer here.
              I want to help people here. Hope my criticism can help. Again, if you feel bad about my words, I apologize to you.

              If you could describe your problem clesrly, many people may help you. Marco, fromZtoA, oldsix, sailor, ... just name a few.更多精彩文章及讨论,请光临枫下论坛 rolia.net
              • thank you for your advice
                I think I have told very clearly, if you don't know what the pattern is, you don't know what I said, in another word, you don't know what I want to do.
                anyway, thank you!
                • Not all things fall into some patterns
                  本文发表在 rolia.net 枫下论坛Dear Guest,

                  Thanks for your reminding about patterns. I did see the word "pattern" in your posting.

                  The context you gave is: 1) , several clients which are a little bit difference 2) the number of clients will be increased sometime . (I copied these words from your posting.)
                  First, I did not understand condition 1) because you made some significant typos; Second, I did not recognize condition 2) is a significant one because I undertand it is a commone sense that a server has a variant client pool. It seems to me that you are still at the stage to choose system configurations. I have to confess I did not see any patterns at such an earlier stage.

                  I have no researches in patterns but I know some of them: 1) Marker pattern; 2) Facade pattern; 3) Singleton pattern; 4) Factory pattern; 5) Immutable pattern; 6) Connector pattern; 7) Model-View-Controller pattern; .... just name a few.

                  Obviously, I mistook you as a novice. Sorry for this misunderstanding. We would be appreciated seeing your posting about the patterns once you fix your architecture conjecture. Thank you in advance.更多精彩文章及讨论,请光临枫下论坛 rolia.net
                  • you are right.
                    "the number of clients will be increased sometime" means add a new client without modifying more source codes, it's more important than the first one, this is the point.
                    you can choose a pattern, and you can write a pattern by yourself, this is my question.
                    • I am still confused
                      本文发表在 rolia.net 枫下论坛Sorry, I seldom heard that one needs to modify the code simply because the client number is increased. Whatever server you have, it has limited ability to serve the clients.
                      Adding 2 or 20 clients cannot be the reason to modify the code. On the other hand, adding 200 or 500 clients may need to re-constrcut the system architect.

                      I don't think we can spot any new, important patterns. All the important patterns have been summarized by experts.

                      If you are interested in patterns, please allow me to challege you with a small pattern. I dare to say it is I who observed this phenomenon as far as I know. Here is the description:

                      In the western society, women usually change their family name after marriage.
                      For instance, Mary Smith was a famiy member of the Smith family. After she married John Kennedy, she became a member of the Kennedy family. The point here is that she got a new data type (KennedyFamilyMember and SmithFamilimember are two kinds of data types, or classes).
                      I guess this can be named as a pattern.
                      Could you offer a solution to this pattern, if it is, in Java or C++?

                      My understanding is that some patterns are too complicated to use. Of course, simple patterns such as Singleton Patterns do help us a lot, to say, in creating a DB connection pool.更多精彩文章及讨论,请光临枫下论坛 rolia.net
                      • my opinion
                        several means 1-100(maybe it's wrong), everybody know
                        class BaseClient {}
                        class Client1:public BaseClient{}
                        class Client2:public BaseClient{}
                        class Client3:public BaseClient{}
                        ...

                        void foo(BaseClient& b){}
                        maybe it defined in another class, you don't need modify it if you add a new client only

                        but, I hope to get a better way to implement it,

                        Actualy, I don't understand your story about name, what do you really want to do?
                        • I am happy to see that you are using Java.
                          Obviously, you do not get my point in my
                          story about marriage. (I think I did not get me accrossed). So please forget abouot it.

                          If we talk about patterns, we should be able to find examples in everyday life. We should first describe it in everyday language, not in IT jargons.

                          I have seen your code. You used inheritance in Java. I suggest you use Adapter pattern.. probably, it would be a better idea to use
                          composition.
                    • Adapter pattern + Facade Pattern
                      本文发表在 rolia.net 枫下论坛Dear Guest,

                      I think I have understood your probelm now.
                      You have a server, which can provide some basic services. To serve the customers from Company A, you need add some "pepper" in your services. To satisfy those from Company B, you need add some "sugar". ..... As you talked about adding clients, you were actually talking about add a class of clients. (This is your ignorance in your early posting. Adding a class of clients is different from adding a single client in the usual sense.) Whatever companies those clients come from, the services they enjoy are basically the same.

                      To solve your probelm, I suggest you use Adapter pattern to wrap your basic services,
                      then add some flavors such as "pepper", "sugar", "vinegar". depending upon the clients. This is the first step. The client is usally not interested in how your server provide services. So the second step is to use Facade pattern to output your services to different clients. If you use Java, this is usually realized using some static methods.

                      I thank you so much for offering me this opportunity to discuss the patterns. If you were in Virginia, I may invite you to have a dinner.更多精彩文章及讨论,请光临枫下论坛 rolia.net
                      • I don't think so.
                        Adapter convert the interface of a class into another interface clients expect.
                        Facade provide a unified interface to a set of interfaces in a subsystem.
                        I don't think it's what I want, i think the most important is the number of clients will increase in future.
    • The discussion is interesting.
      But why doesn't Mr. guest describe the question definitely in one post?
      The question is interesting, but I am afraid that Mr. guest doesn't describe the question completely. What business logic does it have? Why are there so many different type of clients? I think the design pattern just gives us a absact thinking way, Real world design always has some difference. A good design depends on experience, knowledge, inspiration sometimes.
      • Actually, I don't understand this question clearly. I am idiot? :((
        • Dear Marco, I second to you
          It is a Chief Architect in Maryland who led me onto a programmer's track. Last night, I met him and asked him to have a look at the manuscript of my discussion between me and Guest. My instructor condemned me and he told me to shut up.

          My instructor thought I should have not involved in any communication with the guest. He thought such a discussion is pointless. He stressed before me that a good architect is good at explaining customer's requirement, writing definite documentation, doing various trade-off things, ...Finally, he told me that a project is not implemented by packing some patterns.
          I was blamed on. My chief architect's words are: " Why did you present your ideas in the case that some guy just gave you a two-sentense description of his so-called project? Are you so cheap?" Though I felt extremely embarrassed, I had to admit I was wrong.

          I think I had a good lesson. Actually, I did not understand what the Guest wanted to do even after I finished the discussion.
          • yes,I can't understand what he said too.
            But That's ok!Sometimes pepole just don't know what they did.
            Maybe he don't know the process of the projects and need help.
            I don't think jabber did wrong.
            I think jabber is kind guy.

            -Always smile to life! :-)
            • If you'd like to know what I said, read Design Patter written by GOF first.
              Don't care about how many clients I have, don't care about the business logic, it's not related with this topic, I just need a pattern in order to add a new client in future without modifying more codes, maybe it's very simple, maybe not, I don't konw.
              • I think it depends on your application environment and requests of the projects or whatever.
                I think it depends on your application environment and requests of the projects or whatever.Different situations have diffrent patterns, you know. In fact, it don't have the standard achievement pattern for every project.
                You should not focus on that your clients will be more. You should focus the right way to do project. The right way is very important.
                Programming is just the a little part of a project. Can you understand me?
                I recommend you to read some books about projects development .It's a subject.

                :-)
                • you are right, but ...
                  what I need is a pattern to resolve the problem (maybe it's not a problem), it's a part of a project, it's dependent of any platform.
                  the customer has specification, but don't care about it, you can implement it in the derived class, it's not related with the pattern, I guess you didn't read books about design pattern
                  • sorry, it's independent
                    first, we need a pattern to descripbe this situation, then we implement the customer's specification,
                    if you have a server, you write a application which is responsible for answering your customer's request , you have 3 customers now, they have same interface but a little bit different implementation, when you design the software, you know you will have more customers in future, if you need modify a lot of code when you add a new client, sometimes you can't remember where you should add code for the new client, you find you should design your project well at the first
                    that's it.
                    • I just think it's nothing except polymorphism. Am I right?
                      • a lot of patterns will use polymorphism, inheritance, which PATTERN is better for it?
                        Don't answer me before you read a book about pattern.
              • Nothing can I say to what you said....sorry...... actually, many developers I know in Canada have read this book, but I suspect the project is only a imagination.
                • Some thoughts....
                  本文发表在 rolia.net 枫下论坛1). If we assume that the clients are the same, the increase of client numbers cannot be the reason to modify the code. If the clients can be classified into come classes,
                  one may need to modify the code or configure the whole system. This is why I stress one must distinguish one client from one class of clients. Without business context, it is pointless to talk about patterns.

                  2)If the clients are almost the same and they enjoy the service provided by the server, one can use connection pooling, which is already a pattern. In JDBC and EJB, connection pooling technology provides some scalability. However, any server (DB, EJB...) has an upper limit in serving the clients.

                  3) If the clients can be classified, I still suggest using Adapter and Facade patterns.
                  Whenever a new class of clients come about,
                  one can add a new Adapter for them WITHOUT modifying the original code. With the help of Facade pattern, one can output service by adding one or two static methods.
                  It sounds trivial, but it may solve the problem to some extent. Adding some code is better than modifying the original code.

                  4) As we talk about the pattern, we should ask: Does the same thing occur REPEATEDLY in the life? One cannot claim a pattern simply because he/she meets a new issue. In addition, the life (or the project) is complicated, behind some seemingly simple fact are a bunch of patterns co-operating with each other.

                  5) Some time earlier, Marco posted his experiences in a VC++ project. In that project, the system did not work well as the client population reaches 800. Obviously, such system limitation cannot be cured by using some patterns.

                  6) Indeed, patterns are an advanced topic for programmers. If one does know patterns, or has not yet read the book by Gang of Four(GOF), he/she does not need to be discouraged. (Honestly speaking, I have not yet got the chance to lokk into the Gang Of Four book. Probably, I won't read it in the future.) If one is a pattern guru like Mark Grand, he/she does not show off before the peer. My client has a system architect who cannot code in C++, but nobody can deny his string perspective in the system architecture.

                  7) If something is pushed to extremities, things may not go on as expected. For instance, we know that methodology is very important for OOP. If one sticks to the philosophy of three Amigos, the project may fall into the analysis paralysis. Likely, if one insists fitting into some patterns in each aspect of a project, things can become fanny.

                  8)Having reading some famous books does not mean being a guru. Aconcoction of pattern cannot yield a robust project. If one cannot make himsel/herself understood, he cannot undertake the task of being an architect.
                  This is why I have ever said that few Chinese guys can play a role of architect. Being an archiect, one should be able to communicate with novices, laymen using everyday English. If the partner does not understand, one should try to get him/her accrossed using examples.

                  9) Just like Marco, I have nothing more to say.
                  Marco told me that many developers in Canada have read the GOF book. What I realize is that some developers I know are abusing patterns, or using patterns for pattern's sake.更多精彩文章及讨论,请光临枫下论坛 rolia.net