问:
Which things instantly ring alarm bells when looking at code?
I attended a software craftsmanship event a couple of weeks ago and one of the comments made was "I'm sure we all recognize bad code when we see it" and everyone nodded sagely without further discussion.

This sort of thing always worries me as there's that truism that everyone thinks they're an above average driver. Although I think I can recognize bad code I'd love to learn more about what other people consider to be code smells as it's rarely discussed in detail on people's blogs and only in a handful of books. In particular I think it'd be interesting to hear about anything that's a code smell in one language but not another.

I'll start off with an easy one:

Code in source control that has a high proportion of commented out
  code - why is it there? was it meant
  to be deleted? is it a half finished
  piece of work? maybe it shouldn't have
  been commented out and was only done
  when someone was testing something
  out? Personally I find this sort of
  thing really annoying even if it's just the odd line here and there, but when you see large blocks interspersed with the rest of the code it's totally unacceptable. It's
  also usually an indication that the rest of
  the code is likely to be of dubious
  quality as well.

答:
20,000 (exaggeration) line functions. Any function that takes more than a couple of screens needs re-factoring.

Along the same lines, class files that seem to go on forever. There are probably a few concepts that could be abstracted into classes which would clear up the purpose and function of the original class, and probably where it is being used, unless they are all internal methods.

non-descriptive, non-trivial variables, or too many trivial non-descriptive variables. These make deducing what is actually happening a riddle.


问:
Using Domain name in EULA of a software rather than my name in the Licensor field
I intend to sell a software solution. I have already registered a domain but I don't have a registered company. Can I use my website/domain name (eg:myproduct.com) for the licensor field in the EULA rather than using my name?

I will renew my domain yearly if there is a problem with this. Do you know any software companies that work like this?

I'm confused about the users point of view will they find it a bit different.

答:
You say "registered company", so you're not here in the USA, where we have corporations, LLCs, partnerships, doing-business-as ("DBAs"), etc.  Most places where there are registered companies are British Commonwealth countries, where there is usually some organization like the UK's Companies House that is the registrar.  Such places have very strict laws about doing business in your own name or a registered name.

Short answer, you probably shouldn't do this.  Long answer, contact the local equivalent of a lawyer for advice, not a bunch of programmers :-)

ContentLicense: CC BY-SA 3.0


问:
GPL vs plugin interfaces not designed with a specific application in mind
I am not seeking or in need of legal advice, but an interesting though experiment came to my mind.

Imagine the following situtation (I cannot really think about a concrete example and I am unsure if a real manifestation even exists): there is a free (libre) api A licensed under some permissive license or even LGPL. Non-free application B implements this api in order host plugins, but there are other free software doing the same thing. Moreover, there is plugin C acting as a plugin under api A. It links to library D, that is under GPL, so C is also under GPL. Plugins using A are loaded into hosts via a dlopen-like mechanism and use complex data structure for host-plugin communication. Neither B nor C distribute any files that may be required for A to function properly (like headers containing the structure definitions of A or dynamic libraries containing helper functions for A written by the authors of A), but such things may exist.

Now some user installs application B and plugin C on his machine, along with anything that may be required for api A to function properly. Then he proceeds and loads C into B and creates some intellectual property with B which is not a piece of software.

Did a GPL violation happend at some point, and if so, who violated GPL and why?

The authors of C violate D's license by making C possible to be used in non-free host B? This is a possibility because they can't give and exception of GPL (like one described in http://www.gnu.org/licenses/gpl-faq.html#GPLPluginsInNF or http://www.gnu.org/licenses/gpl-faq.html#LinkingOverControlledInterface) due to D's license terms.

The authors of B violate C's and D's license by making C possible to be loaded in B? This is a possibility because http://www.gnu.org/licenses/gpl-faq.html#NFUseGPLPlugins disallows the mechanisms A uses for communitation between the free and non-free modules.

The authors of A, because the api may be used (and in this case, was used) for communication between GPL'd and non-free software. This would be extremely absurd.

The user, because at the moment of loading B into C, he made a derived work of C. I think this is impossible, because he does not distribute it. But would the situation change is he decided to release a configuration file of B which makes B load C as a plugin?

Nobody, because A counts as a 'system library', and both B and C directly interact only with A, not eachother. In a sane world, this would happen...

A concrete example of A could be some kind of audio (think LADSPA) or image processing api. However, I could find no such interface (that is free software, generic and is also implemented by commercial tools). A real-world example could also be quite enlightening.

答: The GPL was not violated by anyone.  A GPL violation only occurs when code is "distributed", i.e., transferred from one party to another.  The only code that changed hands in this example was B, C, and D.  The creator of C honored D's requirement that C be distrbuted under GPL.  The creator of B did not distribute C or D, and is not responsible for the fact that the user combined it with C and D, creating a hybrid system.  So long as the user does not distribute that hybrid system to anyone else, the user is not violating C's or D's GPL terms.


问:
What are the disadvantages of naming things alphabetically?
Let me give you an example of how I name my classes alphabetically:

Car

CarHonda (subclass of Car)

CarHondaAccord (subclass of CarHonda)

There are two reasons why I put the type of the class earlier in its name:

When browsing your files alphabetically in a file explorer, related items appear grouped together and parent classes appear above child classes.

I can progressively refine auto-complete in my IDE. First I type the major type, then the secondary type, and so on without having to memorize what exactly I named the last part of the thing.

My question is why do I hardly see any other programmers do this? They usually name things in reverse or some random order. Take the iOS SDK for example:

UIViewController

UITableViewController

What are the disadvantages of my naming convention and the advantages of their convention?

答:
My 2 cents if I understood right your convention (correct me if I did wrong please).

I believe it will be hard following up on this convention for larger projects. In an ideal world you would have classes doing small tasks and following up good hiding secret principles leading to couple and cohesion. On the real world what I have seen are classes that tend to do a lot of things. Maybe the name requires two or more words to describe the class. In this case, assuming on CarHondaAccord, say that Honda class was a bigger class name composed of more than one word (e.g. yours, TableView). How would you go about differentiating what is your parent class from what is a composed word? (Is Table a parent class of View?). Maybe you could argue from the context, but I would say I would get confused sometimes. This would increase my effort just to understand the class name.

I believe that certain sort of conventions are good to improve maintainability of code on the long run, but you might want to consider how much effort do you put while programming to follow up these conventions. I think that having to run a mini alphabetic order algorithm on my mind every time I would name a subclass could be a burden.

Increases redundancy. Consider the statement of a class in code, you not only declare that your class is a type of other class as it is required by the language, but you also overload the same information on the class name. I believe that a code that would be reusable in this case and has a deep tree of inheritance (Maybe software product line code) would suffer greatly using this name convention. I wouldn't want to be reading the deepest classes name at all or writing it either. (Although you could argue about copying and paste or using a cool IDE auto completion to do the trick).

I believe communication about certain classes would be reduced to pointing the classes as well, as you would probably have a hard time memorizing each class name fully, as knowing it means you know a path from the root parent class to the deepest child. What about multiple inheritance? Ouch! The size of the class following this convention would require scroll to move around very soon. In fact, one HCI principle is to try and avoid giving users keeping things in their short term memories (those that you memorize something and if anything distract you, 'poof!!' they are gone). This would lead potentially to slips, which might increase errors on your code if classes name are similar (they probably are since most of them are similar. Having them being similar also increases the chances of slips). This discussion occurs on Normans book.

Feels less natural. Apple Code Guidelines states this at a certain point for methods name I believe.

It doesn't feel OO for me. I want to call my code objects what I call them in the real world. I don't reason about their parental name hierarchy. I would rather care about the names having a meaningful sense to me, that is, making my life easier to understand, than making the computer file directory list easier to show me them ordered.


答:
If iOS followed the naming convention that you propose, the classes you mention would be named:

UIObjectResponderViewcontroller

UIObjectResponderViewcontrollerTable

There would also be classes with names like:

UIObjectResponderView

UIObjectResponderViewControl

UIObjectResponderViewControlButton

UIObjectResponderViewScroll

UIObjectResponderViewScrollTable

The disadvantages of this naming convention become more and more apparent as this size of the framework grows:

Very long class names.

Most classes start with the same long prefix, like "UIObjectResponderView..."

The sorted order of source files matches the inheritance hierarchy, which isn't nearly as useful as having them groups according to functionality. That is, it's more useful to have XYDetailView and XYDetailViewController end up close to each other than to have XYObjectResponderViewDetail grouped with all the views, and XYObjectResponderViewcontrollerDetail grouped with all the view controllers.

Naming classes according to their inheritance chain violates the "Don't Repeat Yourself" (DRY) principle.

Makes name completion almost useless -- you have to type most of a very long name before the list of possible completions is useful. In Cocoa Touch, nearly every class is derived from NSObject, and a great many classes are derived from NSResponder, and the number of views is fairly large. So every time you want to type the name of a view, you'd have to type at least "UIObjectResponderView" just to get to the (long) list of view classes.

Doesn't work with prefixes. In Objective-C, name prefixes like "NS", "UI", "CF", and "MK" are used to avoid name collisions. UIKit classes all start with "UI", but all those classes are actually derived from NSObject.

Doesn't work well with class names made up of multiple words. A view controller is a controller that manages a view; it is not a view. Using your convention, capitalizing both those words would make "UIObjectResponderViewController" appear to be a subclass of "UIObjectResponderView."

The advantages of more conventional naming schemes are pretty much the inverse of the disadvantages listed above:

Allows much shorter names, like "UIButton" instead of "UIObjectResponderViewControlButton."

Avoids the tediously long common prefixes. Class names are actually readable: "UITextField," "UISlider", "NSManagedObjectContext" and so on.

Source files sort into more useful groups.

Doesn't violate DRY.

You can type just a few characters of a name and get a useful completion list.

& 7. Works fine with different prefixes and with multi-word names.

Title: What are the disadvantages of naming things alphabetically?

Body:
Let me give you an example of how I name my classes alphabetically:

Car

CarHonda (subclass of Car)

CarHondaAccord (subclass of CarHonda)

There are two reasons why I put the type of the class earlier in its name:

When browsing your files alphabetically in a file explorer, related items appear grouped together and parent classes appear above child classes.

I can progressively refine auto-complete in my IDE. First I type the major type, then the secondary type, and so on without having to memorize what exactly I named the last part of the thing.

My question is why do I hardly see any other programmers do this? They usually name things in reverse or some random order. Take the iOS SDK for example:

UIViewController

UITableViewController

What are the disadvantages of my naming convention and the advantages of their convention?


问:
Coding a web browser on Windows using a layout engine?
I've never attempted anything like this before but what I want to do is code a browser for Windows.

I know that I can use the web-browser control that Microsoft has released, but I'm interested in seeing how the problem is solved from a lower level. So I want to know what layout engine I should be looking at? Or is a layout engine the best way to go?

I've been looking at WebKit, but it seems rather Mac-centric, so I'm wondering if there are any more practical one's for windows?

Has Microsoft released the source code for their webbrowser winforms control in the .Net framework? That would be dependent on the CLR anyway, I suppose?

Any suggestions?

答:
I would begin by studying the Gecko layout engine (used by Firefox) and of WebKit (which might seem to be Mac-centric due to its Apple roots). Both are designed to be cross-platform.

Trident (Microsoft's layout engine used by IE and, I assume, in the WebBrowser WinForms control) is closed-source.

But if you are just wanting to code a browser, then I consider writing a layout engine to be "reinventing the wheel", given the two engines that already exist.


问:
What's the term describing this system for generating user interfaces?
So, there's this idea, which you already know: Define the layout of your UI by creating a tree of panels. The leaf nodes on the tree are what we used to call 'controls' way back in the day-- the things that the user interacts with, radio buttons and listboxes and such. The internal nodes are mostly concerned with layout; this kind of panel stacks its child panels vertically, that kind puts its children into a grid, etc.

It's COMMON. Most of the UI-generating systems I've seen in the past twenty years are implementations of this, and the ones that aren't borrow from it.

What's the word for this idea?

EDIT: I'm looking for a word, or a phrase, for the pattern I'm describing. It's a big, high-level pattern, and it's become nearly universal. AWT, HTML forms with the controls in table cells, Swing, XAML, Android, and ASP.NET all use it or borrow from it. There's an idea here, on the same level as concepts like "windowing system" or "mesh network." What do we call it?

I suspect that the real answer is, "there's no consensus on a name for it yet." Which would, itself, be really interesting.

答:
In HTML/CSS you're referring to a relational display model

Where elements are positioned based on their relationship to the elements that come before/after them in the tree.

The alternative is an absolute positioning model where the structure doesn't matter and every element's position is explicitly placed in relation to the top left corner.

Relational is generally preferred because it allows you to make changes to parts of the whole without requiring a full re-calculation of all the offsets within the page.

For example, if you change the offset for a panel that is 5 generations/nodes removed from the main panel; in a relational mode, everything re-flows to compensate automatically; in an absolute model, the offset for all 5 generations/nodes of parent panels need to be re-calculated in cascading order because no child can calculate it's offset in relation to its parent until the parent is updated first.

The tricky part about HTML/CSS layout models is, you can mix them.

For instance, a 5th child panel can be placed using relative positioning (display:relative) but the child elements of that node can be placed using absolute positioning (display:absolute) within that element. Ie Instead of calculating the top-left offset from the window corner, it's taken in relation to the top-left of the box it resides in (5 generations deep).

The power of the relative positioning model is that no child has to be aware of its parent's positioning. Child elements can be blissfully unaware. The difficulty comes in when there are issues/inconsistencies (ie as has happened a lot with browser inconsistencies in the past). Then you'll have to crawl back up the tree one element at a time until you can determine the one causing the trouble.

Fortunately, with tools like FireBug and Google Chrome Developer Tools, it's really easy to crawl through the tree and visualize the layout boxes, padding, margins, etc interact with each other.

Unfortunately, once you adopt a relational model it becomes really difficult to design a typical drag-drop GUI builder tool so most relational GUI development happens in code only. Maybe that will change in the near/distant future.

Note: For completeness sake, I feel like I should also mention the fixed positioning model. It's basically the same as absolute positioning but it is not affected by scrolling. That's how those annoying toolbars that stick to the bottom/side of the page are created on most websites.


问:
Is database based chat room bad idea?
Most of simple "group chat" systems are based on local file storage logs (e.g. log.txt ).

I'm developing a simple group chat (under 20 users simultaneity ) with jQuery/AJAX.

So basically, client-side code loads log from server every second. It needs to be fast.

In database system (PHP/MySQL) that would mean MySQL query every second. Is that overload for server (shared hosting)?

答:
As with anything on shared hosting, it depends a little bit on what else is running on the same server, trying to use the same resources. Provided your host has a sufficient fair-usage policy in place, I think a database query every second for 20 people (the max you stated) would be fine.

If you really need this to be fast, you should really invest in some better hosting though - it is dirt cheap nowadays.

Title: Is database based chat room bad idea?


答:
You described it yourself in the question:

Define the layout of your UI by creating a tree of panels. The leaf
  nodes on the tree are what we used to call 'controls' way back in the
  day

I've always called it variations of: "tree layout", "tree hierarchy [of UI controls/widgets]", and so on.  Sometimes I have to specify "variable-width" since binary trees tend to be what pop into mind, but "tree" applies well in general.

Title: What's the term describing this system for generating user interfaces?

Body:
So, there's this idea, which you already know: Define the layout of your UI by creating a tree of panels. The leaf nodes on the tree are what we used to call 'controls' way back in the day-- the things that the user interacts with, radio buttons and listboxes and such. The internal nodes are mostly concerned with layout; this kind of panel stacks its child panels vertically, that kind puts its children into a grid, etc.

It's COMMON. Most of the UI-generating systems I've seen in the past twenty years are implementations of this, and the ones that aren't borrow from it.

What's the word for this idea?

EDIT: I'm looking for a word, or a phrase, for the pattern I'm describing. It's a big, high-level pattern, and it's become nearly universal. AWT, HTML forms with the controls in table cells, Swing, XAML, Android, and ASP.NET all use it or borrow from it. There's an idea here, on the same level as concepts like "windowing system" or "mesh network." What do we call it?

I suspect that the real answer is, "there's no consensus on a name for it yet." Which would, itself, be really interesting.


问:
How to generate "language-safe" UUIDs?
I always wanted to use randomly generated strings for my resources' IDs, so I could have shorter URLs like this: /user/4jz0k1

But I never did, because I was worried about the random string generation creating actual words, eg: /user/f*cker. This brings two problems: it might be confusing or even offensive for users, and it could mess with the SEO too.

Then I thought all I had to do was to set up a fixed pattern like adding a number every 2 letters. I was very happy with my 'generate_safe_uuid' method, but then I realized it was only better for SEO, and worse for users, because it increased the ratio of actual words being generated, eg: /user/g4yd1ck5

Now I'm thinking I could create a method 'replace_numbers_with_letters', and check that it haven't formed any words against a dictionary or something.

Any other ideas?

ps. As I write this, I also realized that checking for words in more than one language (eg: english and french, spanish, etc) would be a mess, and I'm starting to love numbers-only IDs again.

UPDATE

Some links everyone should read:

http://thedailywtf.com/Articles/The-Automated-Curse-Generator.aspx

Link

答:
There are essentially two strategies that you can employ:

Create a system that won't generate any offensive strings. For example, you can compose your id's only from consonant letters. By leaving out all vowels, you can be sure that your system will never generate any English words, naughty or otherwise.

After generating a completely random id, check to make sure that the new id doesn't include any offensive substrings.

ContentLicense: CC BY-SA 4.0

Title: How to generate "language-safe" UUIDs?


答: I've done this before, in the days before AJAX frameworks were widely used.  Using a database was fine.  The trick is to make sure that each client knows the ID of the latest message that it's seen.  Each time the client asks for new messages, it should submit this ID.  Then when you query the database, retrieve only those messages whose ID exceeds the one provided by the client.  This will be a very fast query, that should only return a small handful of rows at the most.</p>

Title: Is database based chat room bad idea?

Body:
Most of simple "group chat" systems are based on local file storage logs (e.g. log.txt ).

I'm developing a simple group chat (under 20 users simultaneity ) with jQuery/AJAX.

So basically, client-side code loads log from server every second. It needs to be fast.

In database system (PHP/MySQL) that would mean MySQL query every second. Is that overload for server (shared hosting)?


答:
Caching is your answer.

If your shared hosting has enough resources (your application shouldn't demand much) and has some kind of cache system installed, it should be a breeze with caching.

A few ways to do it:

store the messages in the memory directly and retrieve from there,

store the messages in the memory and use insert delayed to store them in database.

store the messages to database, and query the database on intervals and store them in memory.

Apc and memcache are some of the caching solutions out there. Or you can use mysql caching also.

Title: Is database based chat room bad idea?


问:
Biggest mistake you've ever made
Similar to the question I read on Server Fault, what is the biggest mistake you've ever made in an IT related position. Some examples from friends:

I needed to do some work on a production site so I decided to copy over the live database to the beta site. Pretty standard, but when I went to the beta site it was still pulling out-of-date info. OOPS! I had copied the beta database over to the live site! Thank god for backups.

And for me, I created a form for an event that was to be held during a specific time range. Participants would fill out the form for a chance to win, and we would send the event organizers a CSV from the database. I went into the database, and found ONLY 1 ENTRY, MINE. Upon investigating, it appears as though I forgot an auto increment key, and because of the server setup there was no way to recover the lost data.

I am aware this question is similar to ones on Stack Overflow but the ones I found seemed to receive generic answers instead of actual stories :)

What is the biggest coding error/mistake ever…

答:
Built a version of our software on my computer instead of the build computer as it was faster (about 4 hours faster, which meant that it could go into QA that day instead of the next) and the publisher wanted it asap.

I had a special define for debugging on my computer which caused a bug that wasn't detected in QA. They only detected it at the end of 4 weeks of validation testing, but it was bad enough to fail validation.

ContentLicense: CC BY-SA 2.5

Title: Biggest mistake you've ever made


问:
What precautions should be taken when joining a software company?
I am joining a software company very soon as a fresher. But I am afraid that no one knows me and also every one there will be professional.

So I want to know, what precautions should be taken in communication, behavior and other things?

答:
I have some other approach to this...

Be yourself..The truth always comes up eventually. If you are a selfish SOB ,sorry mate but they will get you :)

If not, then you can be humble and express your opinion. If you do it in this way people will take you seriously...

There will always be people that will like you and people who don't. But this is a place to work. Keep personal disputes out of your office.

Admit that your place is very very low in the food chain in there. And by doing that i dont mean to take crap..no...just be humble and offer yourself to anything to start learning. Its another thig to know perfect OOP and another to be able to sustain yourself in a business environment...

Remember every job is like a new cake..It always gets lesser not more..and the moment the cake dissapears , the problems start....

Try to help people and protect your company. Business and personal ethics must prevail in every action of yours.


问:
Web application deployment and Dependencies
I have a free software web application that using other free software scripts for appearance. I have trouble to decide whether should I copy source code of used scripts to my project main repository or list them as dependencies and ask user (who installs application to his server) to install them himself?

Since some of scripts solving browser compatibilities issues and I'm not a good web designer (i hate to check my web site on IE to see compatibility) using the newest version of scripts is preferable and second solution works here. But it has problem with scripts aren't backward-compatible with versions I've used them for development.

Maybe another method is well-known for this issues that I don't know them.

答:
If license allows, you should certainly bundle all libraries and dependencies in a ZIP distribution. For those installing from GIT/SVN you should provide dependency installations.

From my experience with distributing the UI framework is that unless people can download and see result straight away, many will be turned down and will not give you second chance.


答:
IMO a better way would be for the client to request updates and send it the new lines

you can do this by keeping the last 50 lines in a queue (each timestamped)

when a client joins you can send it the entire queue

when the client requests an update find the section that was added since the last line the client requested (the timestamp of which the client provided in the request) and send those

when the client posts a line you added it to the queue and purge the oldest line

no calls to DB and no disk access => fast

if you need logs when a line is added add it to a buffer that you flush periodically to whatever storage system you want to use

Title: Is database based chat room bad idea?


答:
When adapting to any new technical environment, I prefer focusing on deeply understanding problems instead of advocating solutions. Deeply understanding problems allows us to stay humble and understand when solutions are no longer appropriate. Becoming too strongly attached to a specific solution to a problem, or a solution that may have worked on a similar looking problem in the past, can make us blind to the subtle reasons it won't work.

So with that in mind:

DO

Act humble and ask a lot of questions

Read A LOT about the core problem the company is trying to solve

Develop good working and friendly relationships with your colleagues. Assume they know what they are doing until you have strong evidence otherwise.

Become a student of the company's technical problems instead of an advocate for any specific solution that may have worked for you in the past

Share cool/fun technical stuff that could be exciting to your colleagues in a friendly way, with humility, and with the expectation that the new stuff may have severe limitations.

Patiently allow your assertiveness to grow as your comfort in the company's technical problems grows; Even if it turns out in the end you're a genius and they're all dolts, assume going in that the opposite is true until you are very confident in your understanding of the companies problems

Write new code BUT expect your code might end up deleted. The true value is in your learning experience about why the code doesn't work.

Propose new ideas BUT expect your idea might not work out. The true value is in your learning experience about why the idea won't work.

Test ideas through consensus, by proposing ideas to colleagues instead of taking them to the lead/manager as "the solution"

DO NOT

Become too assertive too quickly, give it time

Assume just because at the surface two problems look similar, they are similar. Subtle differences may make one solution completely inappropriate.

Blindly/strongly advocate one solution that you are comfortable with

Become rigidly attached to a specific solution to a problem

Title: What precautions should be taken when joining a software company?

Body:
I am joining a software company very soon as a fresher. But I am afraid that no one knows me and also every one there will be professional.

So I want to know, what precautions should be taken in communication, behavior and other things?


问:
Is BSD license compatible with Apache?
Can I develop a BSD-licensed software that extends an Apache-licensed software (and vice-versa)?</p>

答:
The best answer for this can be found in the apache third party license policy. This is the policy that all apache projects have to follow when using libs with other licenses. As you can see BSD is listed in Category A - Authorized licenses. So it should be no problem using this license. You can also find policies for other licenses here which is quite helpful. In fact I think the Apache policy may also be a good starting point for you own licensing policy if you work for a company.

http://www.apache.org/legal/resolved.html

Title: Is BSD license compatible with Apache?


问:
Best way of Javascript web development in Netbeans (Hot deployment)
I'm beginning Javascript development and as a beginner in JavaScript I make a lot of mistakes. The way I'm developing is very counter-productive because every mistake I fix I have to shutdown Glassfish, re-build the app and re-deploy it. My app is a Java back-end with REST services and the Html, JavaScript, CSS for the frontend. Everything is packed in a .ear file. As of right now, I'm just working with the frontend but I do have to make this whole process to update the files.

My question is ... is there a better way of doing this? Can somebody tell how do you guys work in a similar setup to do the everyday development?

答:
I do a couple of things that greatly increase my efficiency when debugging with javascript, HTML or CSS.  One such method that I use is to separate all static web content into the root context of my web app such that it can be served by an Apache front-end.  Using the mod_jk module of Apache allows this web server to link to a Java application server that serves the dynamic content on the webapp context.

The benefit this gives is that I can make a change in my IDE and run a simple shell script that copies the static web content to the root context of my web server allowing me to instantly see the results without having to compile or package a deployment file.

Another helpful tip would be to look into the Firebug tool for Firefox.  It allows you to debug Javascript, inspect DOM elements, modify HTML, modify styles and also stylesheets on whatever page is currently being viewed in Firefox.  It is an invaluable debug and prototype tool that will save you a lot of time.  It is well worth learning how to use.


问:
How should I group these variables?
I have a shape that will be defined by:

```<code>char s_type;
char color;
double height;
double width;
</code>```

These variables are scanned in from a request string sent to my server and passed into my printing function, which then prints out the shape. Currently they are just local variables sitting in my main(); however, I was wondering if there would be any advantage in creating a struct containing these variables, and then passing the struct to my printing function? or how else might I improve my program's structure/style, would passing a struct by reference have any kind of performance benefit if there were many requests and therefore many printing function calls?

```<code>printer(char st, char cr, double ht, double wd);

int main()
{
    // Other main functionality.

    char s_type;
    char color;
    double height;
    double width;

    sscanf (serv_req, "GET /%c/%c/%lf/%lf", &s_type, &color, &height, &width);

    printer(s_type, color, height, width);

    // Other main functionality.

    return 0;
}
</code>```

It seemed "neater" if I had a struct or something that didn't leave me with declarations in the middle of everything else going on in main. I'm interested in structure/style as well as performance.

EDIT: didn't mean to put printer declaration inside main.

答:
You can use macros to achieve something like:

```<code>sscanf4(serv_req,"GET /%c/%c/%lf/%lf", typ, col, h, w, char, char, double, double);
printer(typ, col, h, w);
</code>```

As for performance, using structs won't make much difference. You can double check that adding for-loop, looping though whole thing 10000 times, and calling timeGetTime() to measure time spent. Usually possibilities to optimize are not where you think they are.

Title: How should I group these variables?

Body:
You can use macros to achieve something like:

sscanf4(serv_req,"GET /%c/%c/%lf/%lf", typ, col, h, w, char, char, double, double);
printer(typ, col, h, w);

As for performance, using structs won't make much difference. You can double check that adding for-loop, looping though whole thing 10000 times, and calling timeGetTime() to measure time spent. Usually possibilities to optimize are not where you think they are.


问:
Google-Gson Converting JSon to CSV
What is the easiest way to convert a Json data to a String at CSV format ?

I haven't read all the api yet but it seems that subclassing the default JSonWriter allows to remove unnecessary character in order to be closer to CSV format.

Does a simpler solution exist ?

答:
May this link help you

in this code XStream api is used which is used to convert XML to Object and vice versa.

Title: Google-Gson Converting JSon to CSV


答:
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
```

Of course without any kind of documentation and the occasional nested #defines

Title: Which things instantly ring alarm bells when looking at code?

Body:
I attended a software craftsmanship event a couple of weeks ago and one of the comments made was "I'm sure we all recognize bad code when we see it" and everyone nodded sagely without further discussion.

This sort of thing always worries me as there's that truism that everyone thinks they're an above average driver. Although I think I can recognize bad code I'd love to learn more about what other people consider to be code smells as it's rarely discussed in detail on people's blogs and only in a handful of books. In particular I think it'd be interesting to hear about anything that's a code smell in one language but not another.

I'll start off with an easy one:

Code in source control that has a high proportion of commented out
  code - why is it there? was it meant
  to be deleted? is it a half finished
  piece of work? maybe it shouldn't have
  been commented out and was only done
  when someone was testing something
  out? Personally I find this sort of
  thing really annoying even if it's just the odd line here and there, but when you see large blocks interspersed with the rest of the code it's totally unacceptable. It's
  also usually an indication that the rest of
  the code is likely to be of dubious
  quality as well.

Body:
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...
#define ...

Of course without any kind of documentation and the occasional nested #defines


答:
You can either make it just randomly generated numbers, or have a regex to cancel out the ones that are offensive:</p>

```<code>/ass/ =~ userid
/boobs/ =~ userid
/morenaughtywordshere/ =~ userid
</code>```

Title: How to generate "language-safe" UUIDs?

Body:
I always wanted to use randomly generated strings for my resources' IDs, so I could have shorter URLs like this: /user/4jz0k1

But I never did, because I was worried about the random string generation creating actual words, eg: /user/f*cker. This brings two problems: it might be confusing or even offensive for users, and it could mess with the SEO too.

Then I thought all I had to do was to set up a fixed pattern like adding a number every 2 letters. I was very happy with my 'generate_safe_uuid' method, but then I realized it was only better for SEO, and worse for users, because it increased the ratio of actual words being generated, eg: /user/g4yd1ck5

Now I'm thinking I could create a method 'replace_numbers_with_letters', and check that it haven't formed any words against a dictionary or something.

Any other ideas?

ps. As I write this, I also realized that checking for words in more than one language (eg: english and french, spanish, etc) would be a mess, and I'm starting to love numbers-only IDs again.

UPDATE

Some links everyone should read:

http://thedailywtf.com/Articles/The-Automated-Curse-Generator.aspx

Link

Body:
You can either make it just randomly generated numbers, or have a regex to cancel out the ones that are offensive:

/ass/ =~ userid
/boobs/ =~ userid
/morenaughtywordshere/ =~ userid


问:
Why should we NOT do frequent deployment in PROD or to test server?
I was instructed by my project manager that frequent deployment in PROD or to test server should be avoided. But I don't understand why? We roll our testing copy to PROD on every sprint end but suddenly client would ask a simple change to the existing application which would require a re-deployment. When every thing was well tested and QA approved. why should we avoid frequent deployment?

How it was done universally?

答:
If you are talking about a hosted web application, the users don't get a say-so in when they get upgrades. That is, they are forced to upgrade each time you do a push to production.

If your changes dramatically change the system rules or UI, you should definitely consider bundling your releases and doing it less frequently. It is very frustrating to users to have to continually re-learn how to use the tools they rely on and violates the UI principle of making them feel they are in control of their computer/software.


问:
Can the overuse of custom taglibs disrupt the outsourcing of html designers?
Yesterday me and a friend were talking about the overuse of custom taglibs.

We create taglibs for everything. We create taglibs in order to wrap jQuery UI elements (tabs, button, etc), and other plugins elements as well. We often wrap them together in a single component. We use taglibs in a point that we almost have no pure html within the body tag.

Our question is: is this a healthy habit? Imagine two situations:

1) We hire an html designer and have the cost of a month for him to learn all this stuff.

2) We want to outsource the html development but no company would get our taglib library to learn, OR it become more expensive.

We love taglibs as its been a lovely shortcut for javascipt development as we write it only once. What would be the best practices in this sense, and what would you suggest? We are looking for a future-proof solution (or an argument that agrees with ours).

答:
One of your uses of taglibs is to encapsulate JavaScript.  Is it possible to do this with just a JavaScript file?  (or a JavaScript file and a div so the JavaScript file can write out any HTML it needs.  or a JavaScript file and a few regular HTML fields.)

JavaScript is very powerful.  It has objects which let you avoid polluting the global namespace.

And no, as noted in the comments writing taglibs for everything is taking it too far.  It's like you wrote your own JSF type language without the benefits of standardization.


问:
best practice for initializing class members in php
I have lots of code like this in my constructors:-

```<code>function __construct($params) {

    $this->property = isset($params['property']) ? $params['property'] : default_val;

}
</code>```

Is it better to do this rather than specify the default value in the property definition? i.e. public $property = default_val? Sometimes there is logic for the default value, and some default values are taken from other properties, which was why I was doing this in the constructor.

Should I be using setters so all the logic for default values is separated?

答:
I've had this kind of philosophical debate with myself before. Here's where I stand most of the time although I realize this is an opinion-based answer:

One thing I see that might help answer the question is the passing of $params which may or may not have attributes/array members that are set.

Over the years I've come to this conclusion:

Avoid the passing of arrays.

Why? Well, there is no way to set or have sentinel values defined for optional passed arguments.

In other words, with the code you specified, you can't do something like this:

```<code>function __construct($arg1 = NULL, $arg2 = DEFAULT_VAL) {

    $this->arg1 = $arg1;

    $this->arg2 = $arg2;

}
</code>```

$arg1 and $arg2 are optional arguments - if not passed they have NULL and DEFAULT_VAL respectively - no need to check explicitly.

Maybe this seems kind of arbitrary.

I think I get what you're trying to accomplish - the passing of a single reference as opposed to tons of arguments. This brings me to my next consclusion:

If not passing "atomic" variables (strings, integers, literals) then pass objects.

There are performance benefits here since passing objects is done by reference (although arrays I think are the roughly the same inside PHP).

So you might do something like:

```<code>function __construct(MyAwesomeObject $oArg) {

        $this->oArg = $oArg;

    }
</code>```

The passed object argument would then be guaranteed to have "property1", "property2" albeit possibly with default values themselves.

Additionally, here you can type hint and a good IDE will correctly autosuggest code completion as well.

But we quickly realize we have a chicken and an egg thing going on: you're constructing an object with passed object arguments that themselves need constructing at some point.

So where does this leave us? Well, I've come to the conclusion that eventually all classes distill down to, for lack of a better term, "atomic" variables (strings, floats, doubles, ints, resources you get my point), and that I tend to try to construct all classes with those variable types or objects - but not arrays.

So did I answer your question?  probably not exactly. But I hope I illustrated something useful albeit somewhat stylistic. I think the code is a bit cleaner, more readable, and less costly.

Now, this isn't to say you shouldn't sanitize your input. That's another discussion entirely.

Hope this helps.

Body:
I've had this kind of philosophical debate with myself before. Here's where I stand most of the time although I realize this is an opinion-based answer:

One thing I see that might help answer the question is the passing of $params which may or may not have attributes/array members that are set.

Over the years I've come to this conclusion:

Avoid the passing of arrays.

Why? Well, there is no way to set or have sentinel values defined for optional passed arguments.

In other words, with the code you specified, you can't do something like this:

function __construct($arg1 = NULL, $arg2 = DEFAULT_VAL) {

    $this->arg1 = $arg1;

    $this->arg2 = $arg2;

}

$arg1 and $arg2 are optional arguments - if not passed they have NULL and DEFAULT_VAL respectively - no need to check explicitly.

Maybe this seems kind of arbitrary.

I think I get what you're trying to accomplish - the passing of a single reference as opposed to tons of arguments. This brings me to my next consclusion:

If not passing "atomic" variables (strings, integers, literals) then pass objects.

There are performance benefits here since passing objects is done by reference (although arrays I think are the roughly the same inside PHP).

So you might do something like:

function __construct(MyAwesomeObject $oArg) {

        $this->oArg = $oArg;

    }

The passed object argument would then be guaranteed to have "property1", "property2" albeit possibly with default values themselves.

Additionally, here you can type hint and a good IDE will correctly autosuggest code completion as well.

But we quickly realize we have a chicken and an egg thing going on: you're constructing an object with passed object arguments that themselves need constructing at some point.

So where does this leave us? Well, I've come to the conclusion that eventually all classes distill down to, for lack of a better term, "atomic" variables (strings, floats, doubles, ints, resources you get my point), and that I tend to try to construct all classes with those variable types or objects - but not arrays.

So did I answer your question?  probably not exactly. But I hope I illustrated something useful albeit somewhat stylistic. I think the code is a bit cleaner, more readable, and less costly.

Now, this isn't to say you shouldn't sanitize your input. That's another discussion entirely.

Hope this helps.


答: Consider using a numeric or hexadecimal key instead.  It will save you a lot of trouble compared to writing an i18n-aware profanity filter, and the worst you'll have to worry about is dead beef.</p>

Title: How to generate "language-safe" UUIDs?


答:
Although I tend to avoid passing arrays to a constructor, sometimes I find it necessary to process an incoming array value (such as for a class that reads values from a configuration file).

In a case like this, I will take advantage of PHP's array functions to ensure that I am working with exactly what I think I'm working with:

```<code>public function import( array $incoming )
{
  $defaults = array(
      'foo' => DEFAULT_FOO
    , 'bar' => DEFAULT_BAR
    ...
  );

  $values = array_merge($defaults, array_intersect_key($incoming, $defaults));

  ...
}
</code>```

That last line uses array_merge() to overwrite any values in $defaults with their corresponding values from $incoming.  I also use array_intersect_key() to ensure that the resulting array does not contain any extra keys that the class/method wouldn't know how to process.

Title: best practice for initializing class members in php

Body:
I have lots of code like this in my constructors:-

```<code>function __construct($params) {

    $this->property = isset($params['property']) ? $params['property'] : default_val;

}
</code>```

Is it better to do this rather than specify the default value in the property definition? i.e. public $property = default_val? Sometimes there is logic for the default value, and some default values are taken from other properties, which was why I was doing this in the constructor.

Should I be using setters so all the logic for default values is separated?

Body:
Although I tend to avoid passing arrays to a constructor, sometimes I find it necessary to process an incoming array value (such as for a class that reads values from a configuration file).

In a case like this, I will take advantage of PHP's array functions to ensure that I am working with exactly what I think I'm working with:

public function import( array $incoming )
{
  $defaults = array(
      'foo' => DEFAULT_FOO
    , 'bar' => DEFAULT_BAR
    ...
  );

  $values = array_merge($defaults, array_intersect_key($incoming, $defaults));

  ...
}

That last line uses array_merge() to overwrite any values in $defaults with their corresponding values from $incoming.  I also use array_intersect_key() to ensure that the resulting array does not contain any extra keys that the class/method wouldn't know how to process.


问:
Which things instantly ring alarm bells when looking at code?
I attended a software craftsmanship event a couple of weeks ago and one of the comments made was "I'm sure we all recognize bad code when we see it" and everyone nodded sagely without further discussion.

This sort of thing always worries me as there's that truism that everyone thinks they're an above average driver. Although I think I can recognize bad code I'd love to learn more about what other people consider to be code smells as it's rarely discussed in detail on people's blogs and only in a handful of books. In particular I think it'd be interesting to hear about anything that's a code smell in one language but not another.

I'll start off with an easy one:

Code in source control that has a high proportion of commented out
  code - why is it there? was it meant
  to be deleted? is it a half finished
  piece of work? maybe it shouldn't have
  been commented out and was only done
  when someone was testing something
  out? Personally I find this sort of
  thing really annoying even if it's just the odd line here and there, but when you see large blocks interspersed with the rest of the code it's totally unacceptable. It's
  also usually an indication that the rest of
  the code is likely to be of dubious
  quality as well.

答:
A lot of people have mentioned:

//TODO: [something not implemented]
```

<p>While I wish that stuff was implemented, at least they made a note. What I think is worse is:</p>

<pre class="lang-c prettyprint-override"><code>//TODO: [something that is already implemented]
</code>```

Todo's are worthless and confusing if you never bother to remove them!

Body:
A lot of people have mentioned:

//TODO: [something not implemented]

While I wish that stuff was implemented, at least they made a note. What I think is worse is:

//TODO: [something that is already implemented]

Todo's are worthless and confusing if you never bother to remove them!


答:
Relational databases are supposed to do exactly that kind of work, log files are not. We can of course argue that there are better/faster solutions but this was not a question at hand so I will skip this.

If you know how to normalize data & use indexes there should be no problem at all but I would suggest archiving older chats into separate set of tables (eg every night move all chats older then 2 days ) so indexes and live data set would be as small as possible and even possibly data set could be kept in memory (MySQL works blazing fast when it can keep all needed data in memory).

On the other hand having 20 requests per second could be a problem on your shared hosting since those kinds of hostings are not meant for that much traffic( only polling data for 1 chatroom with 20 users would generate 1.7 million requests per day). That number of requests can create problems independently of what is your data source (mysql,log file, memcached,mongo).

Title: Is database based chat room bad idea?


问:
How do I prevent useless content load on the page in responsive design?
In responsive design, elements are hidden in the page with @media queries and display: none in CSS.

Ok.

In my design however browsers that have less than 800px in width should avoid loading some content at all.

When accessed with on a device with more than 800px of screen, the page loads fully. In mobile devices or even on desktop with less than 800px of width some content is hidden.

I want to make the page load faster for low-resolution devices and avoid loading chunks of content that the user will never see. How can I go about this?

答:
IMHO this should be handled by browser not you as developer. Why?

1) If you are loading lower resolution images for < 800px width what will happen with desktop users that might load your page with only fraction of their desktop size used (not all users run browsers maximized) and then press 'maximize' button?

2) Using javascript to detect if content is shown will kill mobile phones CPUs & battery so if you decide to use it be very carefull not to abuse it

Responsive design is cool new technique but it will take some time to get everything right. If you look at bostonglobe.com you will see that almost all of the content is loaded independently of your browser width :(


问:
Is mentioning my blog on my resume helpful or hurtful to a job search?
I have a blog that I use mostly to record solutions to problems I have had, that I had some trouble finding an answer to. Mostly problems where the online doc I googled provided too much info, and I found the answer to my question on the fifth page of my third google hit.

(Or if I asked the question here, I either didn't get an answer or I got slammed for asking a question that "the answer could be easily googled.")

I frequently look up stuff on this blog to remind myself of how I solved a problem, and it gets a decent amount of hits from others as well.

Anyway, I was wondering if mentioning this blog on my resume would help or hurt me in a job search? The topics are all over the map.

What I would hope it shows is that

I am a person who finds solutions to problems

I have used many different technologies in my work

I am not afraid to tackle a challenge

What I am concerned it shows is that

This person had trouble with something that simple?

Why is this person bothering to blog this stuff?

答:
It's not necessary.

I always Google the candidates I interview, I check everything Facebook, Twitter, Github, etc. If they have a blog a will find it and read it anyway.


问:
OOP - Composition, Components and Composites Example?
I've been reading a bit about OOP in relation to Composition, Components and Composites. I believe I understand the fundamental principle (not sure).

Can someone please provide a code example of a person or car (both have many properties) using Composition, Components and Composites? I think seeing it in code would clear up the confusion I have regarding this pattern.

Preferably in Java or PHP.

答:
Composition

I see 'Composition' as a general term referring to intentional design. Basically, planning the relationships/interactions of a programming to work in a consistent and predicable manner.

Depending on how you expect your code to be used, whether it's a publicly exposed API or a one-off you need to make choices about which parts you want to expose and how much effort you put into controlling access of parts. OOP in languages like C# and Java are great because you have finer grained control over the access of internal components through the use of access keywords (static, private, public, internal).

I prefer the saying, "APIs are like children, if you do a bad job early on you'll be forced to support them for life."

Basically, you want to strictly control access to your API because anything you make available, other people will eventually depend on. The more you expose, the more other programs will depend on later; making it impossible to make changes later without breaking code.

Components

I see 'Components' as the APIs themselves and their external interfaces. Whether the boundary is based on libraries  (ie dynamically linked libraries), a network interface (ex REST, SOAP), or an multi-process architecture (IPC) it's necessary to define how the different parts interact.

The graph shown on the wikipedia article you linked is pretty useless because it doesn't show what data is shared between the parts.

The best way to go about doing this is, draw out all of the different components, and map all of the inputs/outputs between the different parts.

If you want to pull a Twitter feed to your website then you'd put one component for twitter, one for your website.

Then you discuss the relationship requirements:

Do you want to display a list of recent posts?

Do you want to be able to post to twitter remotely?

In the first case you're requesting and fetching data from twitter so the relationship is described as an output from the twitter API as an input to your application. The reverse is true for posting. You have a post created from your site being outputted to twitter.

The details of the implementation are abstracted away because it's too hard to think about everything at once.

A Component Diagram provides the 'bigger picture' view of the relationships. The amount of detail you want to provide depends on what level of detail you need to communicate those relationships.

Composites

Time to step down from the clouds. Composites actually describe the meat of the code. I'm talking about classes, methods, objects, functions, prototypes, etc... These are the structures that are built and built-on. The number of composites and complexity of their interactions is vast.

In an ideal world where developers have unlimited time to burn and actually like creating documentation, it would make sense to have 100% diagram coverage on the composites. In practice, composite diagrams are near useless because they're never in-sync with the codebase. Even when they are in-sync they're completely redundant and provide no practical application on their own.

Class diagram generators like the one in Visual Studio is great for navigation but I wouldn't consider its use as a composite diagram because it's missing the most important details (ie interface interrelationships).

If you need something outside of the code for users to chomp on, just use an auto documentation generation application and good quality code commenting to produce a Software User's Manual.

Every API ever created suffers from poor design of composites because assumptions about the function of an API tend to change over time. As an example, have you ever heard of YouTube? Would you believe if I told you that it was originally supposed to be a dating site? Google it.

Don't worry, it happens. If you're designing an API, you'll probably break somebody's code at some point. It's inevitable but there are steps you can take early on to minimize the damage.

You'll probably break you own code too. If you're making changes to mission/production critical code that's what tests are for. I would argue that any code that depends on an external API should have full test coverage wherever it touches those APIs but IRL the time investment of making that happen may just be too high.

Enough talk, lets build a fictional architecture to demonstrate

First, build an understanding of what you're trying to accomplish. As an example I'm going to create a fictional SuperStrings library.

It'll include a few different output methods to assist developers:

ToString()

ToVerboseString()

ToLog()

ToFile()

ToTextMessage()

ToTweet()

OK, so you may or may not have seen a ToString() method before but they're pretty common because ToString() is usually a method of the origin 'Object' class. It's also pretty much useless if you try to call it on any complex structure (ex, array, list, classes, etc). We want to revolutionize the world of strings.

I find the best way to start is to identify the components first. Our library isn't called SuperStringLoggingTextMessagingTweeter (unless this was a Microsoft implementation, then that would be totally acceptable). So we want to identify and abstract out the parts that we aren't actually going to code.

ToString() is the most basic primitive and has no dependencies. ToVerboseString() is the same. ToLog(), there are a lot of loggers already available and battle tested so it would be stupid to roll our own. ToFile(), also requires a library dependency. ToTextMessage(), now we're talking. ToTweet(), because we're so web 2.0-y.

So we know we need the following dependencies:

A logging library

A file access library

A text message library

A twitter API, or a library that implements one

The Component diagram would easily be explained as your library in the center with a 1-1 relationship with each of these dependencies. If your API is included in another application then there would be a 1-1 relationship with that app (or 1-many depending on how it's used).

The composites will be the methods described above as well as any related interfaces that implements one or more of them.

So you have the following static public methods:

```<code>// Displays only the value of the variable
SuperString.ToString(var)
SuperString.ToString(string)

// Displays the label, type, and value of a variable in an easy-to-grep format
SuperString.ToVerboseString(var)
SuperString.ToVerboseString(string)

// Outputs an 'INFO' log notice with the string in verbose format
SuperString.ToLog(var)
SuperString.ToLog(string)

// Appends the verbose string to a file
SuperString.ToFile(var)
SuperString.ToFile(string)

// Outputs the verbose string to a text message
SuperString.ToTextMessage(var)
SuperString.ToTextMessage(string)

// Creates a tweet containing the the verbose string
SuperString.ToTweet(var)
SuperString.ToTweet(string)
</code>```

Interfaces, the sticky stuff that holds everything together

Finally, the fun part...

This is the stuff that you'll never see in a diagram because it's just too damn complex to draw. The 'creative' branch of development. The reason experienced developers laugh when a newbie claims, 'I know how to program' because they've finally managed to grasp basic programming fundamentals (ex, for loops, variables, arrays, etc).

When I say 'Interfaces' I'm not referring to the way they're implemented in some languages (ie, like C#). I'm referring to the more abstract concept of 'code that connects the constituent parts of functions/classes/methods into a complete model'.

It's completely possible (but possibly really difficult) to map all these out in your composite diagram once you know what you're trying to identify.

I mean:

Class Inheritance

Multiple Inheritance

Prototypes

Interfaces (the way C uses them)

etc...

These are the parts that turn a collection of one-off classes into a complicated web of interrelated class structures.

When you design interfaces, be very cautious about over-engineering. It's tempting to buy into the worshippers of abstracts and other such nonsense.

If you need a hard-fast rule for designing interfaces:

Go depth-first and abstract commonality only where it makes sense later

It's very easy to code yourself into a corner and lose the leverage to be creative. DRY (Don't Repeat Yourself) is a great principle but a poorly-designed or over-engineered class structure will require as many or more lines of boilerplate to 'break the mold' of a rigid structure as it would've taken to copy/paste a few sections of code.

The same thing applies to database normalization. Sure, normalizing a massive web of interrelated tables is impressive (and may provide some job security over the long-term); but, it'll probably make your head hurt every time you're forced to change it.

In short, weigh the consequences of your design and (hopefully) do what you can do prevent future suffering. Welcome to Software Development Ethics 101.

How you go about designing interfaces depends completely on the platform...

I would also argue that learning how to build interfaces between classes/prototypes/functions in multiple languages is the most valuable part of picking up new languages. I will attempt to explain a few uses but only as a taste of what's possible. To provide a complete list would be an undertaking equivalent to describing every possible medium an artist could use.

Interfaces:

I figured I'd start with the most obvious. Pretty simple stuff, there's no functional code in an interface, it's just inherited as a contract of what your class should be capable of. The example code above could easily be implemented. Just create an interface, attach it to the SuperString (Ie common base) class, but don't implement the methods in the base class.

It's like an abstract base class but you can see it coming before the compiler throws a debug error, and it can be re-used anywhere.

Abstract Base Classes

If you're considering creating an ABC (Abstract Base Class) ::cringe::, dont...

Why do I hate ABCs so much? Because they're basically implicitly inherited abstracts. Interfaces, OTOH are explicitly inherited abstracts.

If you feel the need to practice the art of abstract classes/methods, do us all a favor and make them explicit (ie using an interface). Thank you.

Access Keywords:

I'm talking about public/private/internal. It's safe to ignore these altogether and make everything public if you're the only person who will ever touch the code. You only learn to appreciate them when it comes time to design an API.

When you're providing a module/dll any function/class/method that you make available will become a dependency of someone else's application at some point. You could literally create a test class that does nothing but demonstrate usage and some lazy guy out in the world will decide to use it in production-sensitive code just to save from re-writing it himself.

This is where the 'APIs are like children' saying applies. If you're draconian about locking down access early on, you'll give yourself more leverage to improve the internal implementations later.

Protypes:

This is like the magical hidden base class of all classes. In JavaScript, if you don't like the .ToString() method of every single object in the whole language; no problem, just define a different prototype. Of course, you'll probably break a lot of code in the process.

Prototypes are the antithesis of 'Access Keywords' because they give everybody the power to change everything. Instead of sitting down and mapping out the object inheritance hierarchy before writing your classes (like you'd do in C#) you can just dump a different function/method into a function/class because in functional programming, functions are just another form of variable.

I nervously giggle like a schoolgirl because I feel like the OOP gods are looking down on me with disdain every time I use one of these. Ignoring preference and security, prototypes are the interface that make 90% of OOP source code look like boilerplate.

Functional Properties:

This use may be a little more subtle but like I said before, JavaScript is functional so you can overwrite a class/function's method/function by re-assigning it. "That's nice but how does it apply to interfaces," you may ask. Well, you can use deep-cloning to clone parts of one class/function to another.

This is basically how multiple inheritance works in JavaScript.

Multiple Inheritance:

Basically, what it says. Create classes with sub-parts of your classes that can be inherited willy-nilly. What's the big deal? Circular references, that's what.

Without multiple-inheritance you get the mess that is Java/C# class design. I can't pretend to understand the extent of why Java/C# killed multiple inheritance but I'll assume that there are good reasons beside, "to save the developer from himself/herself."

What I do know, without multiple inheritance you'll need a lot more biolerplate code to generalize classes that share similar but in-exact implementations of code. With multiple inheritance, you'll be putting yourself in 'the danger zone;' but, some of us like that sort of thing.

Aside:

Warning: Excessive 'Hand-Waviness' Ahead - If you don't understand what, "with a grain of salt" means, it's safe to ignore the rest.

In the world of academia (or at least what I can infer from the outside) professors are absolutely in love with the concept of abstract classes. Being self-taught (and learning C# as my first 'real' OOP language after PHP) I read a lot about classes before I ever started to gain an understanding of how they're implemented.

Of about 2k-3k pages and still lacking an understanding of OOP I finally came across a book that had practical examples I could whip up in Visual Studio and skipped right over all of the inheritance complexity and abstract class nonsense.

I'm one of those annoying people who can't connect how concept A maps to concept B until I see it in action so the depth-first approach that schools prefer makes me angry. One of the reasons I have a talent for coding is my ability to visualize massive complex structures and how they're interrelated in my head. It comes second-nature to me like breathing but mapping abstract concepts without any practical application is like chasing ghosts.

OOP is a very powerful programming paradigm. And the concept of mapping real-world objects directly to code just makes sense but the way it's taught explains why many people complete a degree and still don't know how to code.

I used to be an OOP evangelist for two reasons. First, OOP was the most useful paradigm I knew of to structure a program at the time. Second, I spent so much time bashing my head against the wall trying to figure it out that I was too emotionally invested to see a different perspective.

Nowadays, I find it a lot easier (and less stressful) to be open-minded. I can understand why rigid design facilities like UML diagrams were created. Architecting an application is hard and communicating an architecture to a group is even more difficult. Just don't make the mistake of idealizing a system where you can create a UML diagram and translate it directly to a working program. It has been done many times and it sucked every time.

The more rigid design structures like the ones presented in UML are, more creative leverage you sacrifice. Writing code is a creative art. That's why you hear graphic-designer-like expressions (ex, cleanliness, elegance, etc) being used to describe code.

Software doesn't 'need' design files because the source code itself is a design file. If the source code is way to complex to understand by taking a bredth-first look at the module hierarchy, maybe you language just requires too much boilerplate to stand on its own.

At the end of the day, ask yourself. How many poets actually used correct grammar in their writings. Formalized concepts are overrated and sometimes it's necessary to break the rules.

Body:
Composition

I see 'Composition' as a general term referring to intentional design. Basically, planning the relationships/interactions of a programming to work in a consistent and predicable manner.

Depending on how you expect your code to be used, whether it's a publicly exposed API or a one-off you need to make choices about which parts you want to expose and how much effort you put into controlling access of parts. OOP in languages like C# and Java are great because you have finer grained control over the access of internal components through the use of access keywords (static, private, public, internal).

I prefer the saying, "APIs are like children, if you do a bad job early on you'll be forced to support them for life."

Basically, you want to strictly control access to your API because anything you make available, other people will eventually depend on. The more you expose, the more other programs will depend on later; making it impossible to make changes later without breaking code.

Components

I see 'Components' as the APIs themselves and their external interfaces. Whether the boundary is based on libraries  (ie dynamically linked libraries), a network interface (ex REST, SOAP), or an multi-process architecture (IPC) it's necessary to define how the different parts interact.

The graph shown on the wikipedia article you linked is pretty useless because it doesn't show what data is shared between the parts.

The best way to go about doing this is, draw out all of the different components, and map all of the inputs/outputs between the different parts.

If you want to pull a Twitter feed to your website then you'd put one component for twitter, one for your website.

Then you discuss the relationship requirements:

Do you want to display a list of recent posts?

Do you want to be able to post to twitter remotely?

In the first case you're requesting and fetching data from twitter so the relationship is described as an output from the twitter API as an input to your application. The reverse is true for posting. You have a post created from your site being outputted to twitter.

The details of the implementation are abstracted away because it's too hard to think about everything at once.

A Component Diagram provides the 'bigger picture' view of the relationships. The amount of detail you want to provide depends on what level of detail you need to communicate those relationships.

Composites

Time to step down from the clouds. Composites actually describe the meat of the code. I'm talking about classes, methods, objects, functions, prototypes, etc... These are the structures that are built and built-on. The number of composites and complexity of their interactions is vast.

In an ideal world where developers have unlimited time to burn and actually like creating documentation, it would make sense to have 100% diagram coverage on the composites. In practice, composite diagrams are near useless because they're never in-sync with the codebase. Even when they are in-sync they're completely redundant and provide no practical application on their own.

Class diagram generators like the one in Visual Studio is great for navigation but I wouldn't consider its use as a composite diagram because it's missing the most important details (ie interface interrelationships).

If you need something outside of the code for users to chomp on, just use an auto documentation generation application and good quality code commenting to produce a Software User's Manual.

Every API ever created suffers from poor design of composites because assumptions about the function of an API tend to change over time. As an example, have you ever heard of YouTube? Would you believe if I told you that it was originally supposed to be a dating site? Google it.

Don't worry, it happens. If you're designing an API, you'll probably break somebody's code at some point. It's inevitable but there are steps you can take early on to minimize the damage.

You'll probably break you own code too. If you're making changes to mission/production critical code that's what tests are for. I would argue that any code that depends on an external API should have full test coverage wherever it touches those APIs but IRL the time investment of making that happen may just be too high.

Enough talk, lets build a fictional architecture to demonstrate

First, build an understanding of what you're trying to accomplish. As an example I'm going to create a fictional SuperStrings library.

It'll include a few different output methods to assist developers:

ToString()

ToVerboseString()

ToLog()

ToFile()

ToTextMessage()

ToTweet()

OK, so you may or may not have seen a ToString() method before but they're pretty common because ToString() is usually a method of the origin 'Object' class. It's also pretty much useless if you try to call it on any complex structure (ex, array, list, classes, etc). We want to revolutionize the world of strings.

I find the best way to start is to identify the components first. Our library isn't called SuperStringLoggingTextMessagingTweeter (unless this was a Microsoft implementation, then that would be totally acceptable). So we want to identify and abstract out the parts that we aren't actually going to code.

ToString() is the most basic primitive and has no dependencies. ToVerboseString() is the same. ToLog(), there are a lot of loggers already available and battle tested so it would be stupid to roll our own. ToFile(), also requires a library dependency. ToTextMessage(), now we're talking. ToTweet(), because we're so web 2.0-y.

So we know we need the following dependencies:

A logging library

A file access library

A text message library

A twitter API, or a library that implements one

The Component diagram would easily be explained as your library in the center with a 1-1 relationship with each of these dependencies. If your API is included in another application then there would be a 1-1 relationship with that app (or 1-many depending on how it's used).

The composites will be the methods described above as well as any related interfaces that implements one or more of them.

So you have the following static public methods:

// Displays only the value of the variable
SuperString.ToString(var)
SuperString.ToString(string)

// Displays the label, type, and value of a variable in an easy-to-grep format
SuperString.ToVerboseString(var)
SuperString.ToVerboseString(string)

// Outputs an 'INFO' log notice with the string in verbose format
SuperString.ToLog(var)
SuperString.ToLog(string)

// Appends the verbose string to a file
SuperString.ToFile(var)
SuperString.ToFile(string)

// Outputs the verbose string to a text message
SuperString.ToTextMessage(var)
SuperString.ToTextMessage(string)

// Creates a tweet containing the the verbose string
SuperString.ToTweet(var)
SuperString.ToTweet(string)

Interfaces, the sticky stuff that holds everything together

Finally, the fun part...

This is the stuff that you'll never see in a diagram because it's just too damn complex to draw. The 'creative' branch of development. The reason experienced developers laugh when a newbie claims, 'I know how to program' because they've finally managed to grasp basic programming fundamentals (ex, for loops, variables, arrays, etc).

When I say 'Interfaces' I'm not referring to the way they're implemented in some languages (ie, like C#). I'm referring to the more abstract concept of 'code that connects the constituent parts of functions/classes/methods into a complete model'.

It's completely possible (but possibly really difficult) to map all these out in your composite diagram once you know what you're trying to identify.

I mean:

Class Inheritance

Multiple Inheritance

Prototypes

Interfaces (the way C uses them)

etc...

These are the parts that turn a collection of one-off classes into a complicated web of interrelated class structures.

When you design interfaces, be very cautious about over-engineering. It's tempting to buy into the worshippers of abstracts and other such nonsense.

If you need a hard-fast rule for designing interfaces:

Go depth-first and abstract commonality only where it makes sense later

It's very easy to code yourself into a corner and lose the leverage to be creative. DRY (Don't Repeat Yourself) is a great principle but a poorly-designed or over-engineered class structure will require as many or more lines of boilerplate to 'break the mold' of a rigid structure as it would've taken to copy/paste a few sections of code.

The same thing applies to database normalization. Sure, normalizing a massive web of interrelated tables is impressive (and may provide some job security over the long-term); but, it'll probably make your head hurt every time you're forced to change it.

In short, weigh the consequences of your design and (hopefully) do what you can do prevent future suffering. Welcome to Software Development Ethics 101.

How you go about designing interfaces depends completely on the platform...

I would also argue that learning how to build interfaces between classes/prototypes/functions in multiple languages is the most valuable part of picking up new languages. I will attempt to explain a few uses but only as a taste of what's possible. To provide a complete list would be an undertaking equivalent to describing every possible medium an artist could use.

Interfaces:

I figured I'd start with the most obvious. Pretty simple stuff, there's no functional code in an interface, it's just inherited as a contract of what your class should be capable of. The example code above could easily be implemented. Just create an interface, attach it to the SuperString (Ie common base) class, but don't implement the methods in the base class.

It's like an abstract base class but you can see it coming before the compiler throws a debug error, and it can be re-used anywhere.

Abstract Base Classes

If you're considering creating an ABC (Abstract Base Class) ::cringe::, dont...

Why do I hate ABCs so much? Because they're basically implicitly inherited abstracts. Interfaces, OTOH are explicitly inherited abstracts.

If you feel the need to practice the art of abstract classes/methods, do us all a favor and make them explicit (ie using an interface). Thank you.

Access Keywords:

I'm talking about public/private/internal. It's safe to ignore these altogether and make everything public if you're the only person who will ever touch the code. You only learn to appreciate them when it comes time to design an API.

When you're providing a module/dll any function/class/method that you make available will become a dependency of someone else's application at some point. You could literally create a test class that does nothing but demonstrate usage and some lazy guy out in the world will decide to use it in production-sensitive code just to save from re-writing it himself.

This is where the 'APIs are like children' saying applies. If you're draconian about locking down access early on, you'll give yourself more leverage to improve the internal implementations later.

Protypes:

This is like the magical hidden base class of all classes. In JavaScript, if you don't like the .ToString() method of every single object in the whole language; no problem, just define a different prototype. Of course, you'll probably break a lot of code in the process.

Prototypes are the antithesis of 'Access Keywords' because they give everybody the power to change everything. Instead of sitting down and mapping out the object inheritance hierarchy before writing your classes (like you'd do in C#) you can just dump a different function/method into a function/class because in functional programming, functions are just another form of variable.

I nervously giggle like a schoolgirl because I feel like the OOP gods are looking down on me with disdain every time I use one of these. Ignoring preference and security, prototypes are the interface that make 90% of OOP source code look like boilerplate.

Functional Properties:

This use may be a little more subtle but like I said before, JavaScript is functional so you can overwrite a class/function's method/function by re-assigning it. "That's nice but how does it apply to interfaces," you may ask. Well, you can use deep-cloning to clone parts of one class/function to another.

This is basically how multiple inheritance works in JavaScript.

Multiple Inheritance:

Basically, what it says. Create classes with sub-parts of your classes that can be inherited willy-nilly. What's the big deal? Circular references, that's what.

Without multiple-inheritance you get the mess that is Java/C# class design. I can't pretend to understand the extent of why Java/C# killed multiple inheritance but I'll assume that there are good reasons beside, "to save the developer from himself/herself."

What I do know, without multiple inheritance you'll need a lot more biolerplate code to generalize classes that share similar but in-exact implementations of code. With multiple inheritance, you'll be putting yourself in 'the danger zone;' but, some of us like that sort of thing.

Aside:

Warning: Excessive 'Hand-Waviness' Ahead - If you don't understand what, "with a grain of salt" means, it's safe to ignore the rest.

In the world of academia (or at least what I can infer from the outside) professors are absolutely in love with the concept of abstract classes. Being self-taught (and learning C# as my first 'real' OOP language after PHP) I read a lot about classes before I ever started to gain an understanding of how they're implemented.

Of about 2k-3k pages and still lacking an understanding of OOP I finally came across a book that had practical examples I could whip up in Visual Studio and skipped right over all of the inheritance complexity and abstract class nonsense.

I'm one of those annoying people who can't connect how concept A maps to concept B until I see it in action so the depth-first approach that schools prefer makes me angry. One of the reasons I have a talent for coding is my ability to visualize massive complex structures and how they're interrelated in my head. It comes second-nature to me like breathing but mapping abstract concepts without any practical application is like chasing ghosts.

OOP is a very powerful programming paradigm. And the concept of mapping real-world objects directly to code just makes sense but the way it's taught explains why many people complete a degree and still don't know how to code.

I used to be an OOP evangelist for two reasons. First, OOP was the most useful paradigm I knew of to structure a program at the time. Second, I spent so much time bashing my head against the wall trying to figure it out that I was too emotionally invested to see a different perspective.

Nowadays, I find it a lot easier (and less stressful) to be open-minded. I can understand why rigid design facilities like UML diagrams were created. Architecting an application is hard and communicating an architecture to a group is even more difficult. Just don't make the mistake of idealizing a system where you can create a UML diagram and translate it directly to a working program. It has been done many times and it sucked every time.

The more rigid design structures like the ones presented in UML are, more creative leverage you sacrifice. Writing code is a creative art. That's why you hear graphic-designer-like expressions (ex, cleanliness, elegance, etc) being used to describe code.

Software doesn't 'need' design files because the source code itself is a design file. If the source code is way to complex to understand by taking a bredth-first look at the module hierarchy, maybe you language just requires too much boilerplate to stand on its own.

At the end of the day, ask yourself. How many poets actually used correct grammar in their writings. Formalized concepts are overrated and sometimes it's necessary to break the rules.


问:
What does "automating a use case" mean and  what are the tools to do it?
What does 'automating a use case 'means and how does the tools that automate helps with that?
whats makes automation good to do and does it holds any significance for web developement.</p>

答:
Suppose you have a form where users can make an account. Would you prefer to manually fill in 20 text boxes, tens of times with all kinds of input that may give wrong results? Or would you rather have an automatic test do that for you in a matter of seconds?

A use case by all means is some action or procedure that your application should support, for example "register". A use case is something that one or more "actors" can do, people who would be users of your application for example "site visitor".

An automated test for the use case "register" that a "site visitor" can do, would be to create various inputs for the different data, preferrably a mixture of valid and invalid ones, then create a test class that tries to use your program with these inputs, test whether the invalid ones are correctly detected and the valid ones are accepted by using assert statements, then view the test results.

Writing the test can take a lot of time, but the big advantage is that it should still work after you made changes to your application. If it doesn't, that means you have introduced a bug into your application.

The most interesting datatypes to test for are things like numbers and dates, where you should test for interval edges, if any apply.


问:
Any basic difference between Unix and Linux in design and other aspects?
I keep reading this sentence:

Linux is a Unix-like system, but it is not Unix.

I don't know what's the real difference between the two. I know Linux got a lot of ideas from Unix and the licenses of the two are different. Apart from that, as I am not an expert in either one of them, I want to know whether there are basic differences between them in design or other significant aspects.

答:
Linux comes with many tools such as:

GUI system

GNU utilities (such as cp, mv, ls, date, bash etc)

installation & management tools

GNU C/C++ Compilers

Editors (vi)

and various applications (such as OpenOffice, Firefox).

However, most UNIX operating systems are considered as a complete operating system as everything come from a single source or vendor.

Some things they share:

GUI, file, and windows managers (KDE, Gnome)

Shells (ksh, csh, bash)

Various office applications such as OpenOffice.org

Development tools (perl, php, python, GNU C/C++ compilers)

POSIX interface


答:
Style is pretty subjective; if using a struct makes the code look better to you, do it. Unless your printer() function is trivial the way you pass the data (struct or not, by reference or not) won't make a measurable difference.

Probably the best thing you could do for your code would be to break out the various parts of main() indicated by the "other main functionality" comments into separate functions.

Title: How should I group these variables?

Body:
I have a shape that will be defined by:

```<code>char s_type;
char color;
double height;
double width;
</code>```

These variables are scanned in from a request string sent to my server and passed into my printing function, which then prints out the shape. Currently they are just local variables sitting in my main(); however, I was wondering if there would be any advantage in creating a struct containing these variables, and then passing the struct to my printing function? or how else might I improve my program's structure/style, would passing a struct by reference have any kind of performance benefit if there were many requests and therefore many printing function calls?

```<code>printer(char st, char cr, double ht, double wd);

int main()
{
    // Other main functionality.

    char s_type;
    char color;
    double height;
    double width;

    sscanf (serv_req, "GET /%c/%c/%lf/%lf", &s_type, &color, &height, &width);

    printer(s_type, color, height, width);

    // Other main functionality.

    return 0;
}
</code>```

It seemed "neater" if I had a struct or something that didn't leave me with declarations in the middle of everything else going on in main. I'm interested in structure/style as well as performance.

EDIT: didn't mean to put printer declaration inside main.


答:
UNIX is a family of operating systems and nowadays UNIX is more of a brand owned by The Open Group. For an operating system to be branded UNIX, it must undergo a conformance testing, and for Linux this would mean that every distribution out there (Ubuntu, Debian, Fedora, Red Hat, etc) would have to separately undergo this conformance testing for every release. So this is one of the main reasons why Linux is a unix-like system and not a UNIX.

This testing that I mentioned is to ensure the OS compliance with the Single Unix Specification, which is currently at version 4 SUSv4 (Single Unix Specification version 4). This specification defines a set of APIs that must be available to applications for a system to be qualified for the name UNIX.

Title: Any basic difference between Unix and Linux in design and other aspects?

Body:
I keep reading this sentence:

Linux is a Unix-like system, but it is not Unix.

I don't know what's the real difference between the two. I know Linux got a lot of ideas from Unix and the licenses of the two are different. Apart from that, as I am not an expert in either one of them, I want to know whether there are basic differences between them in design or other significant aspects.


答:
A "Unix like" system may be fully compliant with the Single UNIX Specification, the collective name of standards for what qualifies as a Unix system, but at the same time Unix is a registered trademark of The Open Group and vendors of Unix like systems need to get their systems registered to officially qualify as Unix. Currently the registered UNIX 03 systems are:

Apple Inc.: Mac OS X Version 10.5 Leopard on Intel-based Macintosh computers

Apple Inc.: Mac OS X Version 10.6 Snow Leopard on Intel-based Macintosh computers

Fujitsu Limited: Solaris™10 Operating System on Fujitsu PRIMEPOWER® 64-bit SPARC® Based Platforms

Hewlett-Packard Company: HP-UX 11i V3 Release B.11.31 or later on HP Integrity Servers

IBM Corporation: AIX 5L for POWER V5.2 dated 8-2004 or later with APARs: IY59610, IY60869, IY61405 with VAC 6.0.0.8 or later on pSeries CHRP systems

IBM Corporation: AIX 5L for POWER V5.3 dated 7-2006 or later on Systems using CHRP system architecture with POWER™processors

IBM Corporation: AIX 6 Operating System V6.1.2 with SP1 or later on Systems using CHRP system architecture with POWER™ processors and 2, 8 or 128 port async cards

Oracle Corporation: Oracle Solaris 11 FCS and later on SPARC-based platforms, 32-bit and 64-bit and on X86-based platforms, 32-bit and 64-bit

Oracle Corporation: Solaris 10 Operating System plus patch 118844-06 for X86 and on, on 64-bit X86 based systems

Oracle Corporation: Solaris 10 Operating System and on, on 32-bit and 64-bit SPARC based systems

Oracle Corporation: Solaris 10 Operating System and on, on 32-bit X86 based systems

Vendors of open source Unix like systems (mostly Linux and FreeBSD) typically don't register with The Open Group, either to avoid the costs of certification or, well, because they don't find much value in doing so. In theory, it's entirely possible that a Unix like system is technically Unix, and all it's missing is certification.

The Linux Foundation on the other hand, created the Linux Standard Base, an ISO standard, in an effort to standardize Linux. Compliance with POSIX
is at the heart of both the SUS and the LSB, maintaining in a way the link between Unix and Linux.

Unix and Unix like systems tend to be more similar than different, in theory all popular Unix flavours, registered or not, are POSIX compliant (full or mostly), so they share a core programming interface, shells and utilities (and a lot of other stuff). IEEE and The Open Group maintain a freely available copy of the latest version, POSIX.1-2008, where you can find more information on what POSIX compliance actually means.

Now, apart from the legal and technical reasons, Linux inherited the "not Unix" mantra from it's association with GNU, a Unix like operating system initiated by Richard Stallman. GNU stands for "GNU's not Unix", as Stallman's intentions were to build a Unix compatible system that would be free, and in order to do that it should contain no Unix code, as Unix is proprietary.

Early Linux developers started porting GNU tools to Linux, and the resulting system was referred as GNU/Linux as early as 1992. There is a long lasting controversy on whether Linux should be referred to as Linux or GNU/Linux (as it incorporates several parts of GNU), but that's irrelevant to your question, what's relevant is that "not Unix" may just refer to the association with GNU and have little to do with it's design, depending on context.

The "History of Linux" article on Wikipedia explains the origins of Linux and it's relationship with Unix (via Minix and GNU) in some detail, and you should also take some time to read through the references of the article, if you are interested in learning more.